package com.sutuijingling.a;

import android.graphics.Rect;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.android.uiautomator.core.UiDevice;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiScrollable;
import com.android.uiautomator.core.UiSelector;
import com.sutuijingling.bean.AccountBean;
import com.sutuijingling.bean.SearchBean;
import com.sutuijingling.bean.TopBean;
import com.sutuijingling.bean.f;
import com.sutuijingling.result.WorkStatus;
import com.sutuijingling.result.w;
import com.sutuijingling.utils.a;
import com.sutuijingling.utils.b;
import com.sutuijingling.utils.c;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.apache.http.HttpStatus;

public class i extends e {
    static int a = 10;
    static int b = 0;
    public static boolean c = false;
    public static int d = -1;
    public static List e = null;
    static int f = 26;
    static String g = "";
    public static int h = -1;
    static int i = 20;
    static Random j = new Random();
    public static int k = 0;
    static String l = "/data/data/jp.jun_nama.test.utf7ime/files/ztcSwipeNum";
    static int m = 0;
    static String n = "/data/data/jp.jun_nama.test.utf7ime/files/zxSwipeNum";
    static int o = 0;
    static int p = 0;
    static List q = new ArrayList();
    static int r = 0;
    static String s = "/data/data/jp.jun_nama.test.utf7ime/files/swipeNum.txt";
    static int t = 0;
    static boolean u = false;
    int v = 0;
    private b w = b.a();
    private boolean x = false;
    private int y = 0;

    public i(UiDevice uiDevice) {
        this.device = uiDevice;
    }

    public i(SearchBean searchBean, UiDevice uiDevice) {
        super(uiDevice);
        this.searchParams = searchBean;
    }

    public i(TopBean topBean, UiDevice uiDevice) {
        super(uiDevice);
        this.searchParams = topBean.getSearchBean();
        this.accParams = topBean.getAcc();
        this.missionId = topBean.getTaskId();
    }

    private UiObject V() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/bottombar_layout", 1);
        if (findByResId == null || !findByResId.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/ll_bottom_bar", 1);
            if (findByResId == null || !findByResId.exists()) {
                findByResId = findText("加入购物车", 1);
                if (findByResId == null || !findByResId.exists()) {
                    findByResId = findText("立即购买", 1);
                    if (findByResId != null && findByResId.exists()) {
                    }
                }
            }
        }
        return findByResId;
    }

    private void W() throws UiObjectNotFoundException {
        UiObject findText = findText("全部宝贝", 1);
        if (findText.exists()) {
            c.c(findText);
            c.d();
        }
        int nextInt = j.nextInt(3) + 3;
        int i = 0;
        while (i < 8) {
            if (e == null || e.size() < nextInt) {
                int i2 = 150;
                int displayHeight = this.device.getDisplayHeight() - 100;
                UiObject X = X();
                if (X != null && X.exists()) {
                    i2 = X.getBounds().bottom;
                }
                X = Y();
                if (X != null && X.exists()) {
                    displayHeight = X.getBounds().top - 40;
                }
                X = k();
                if (X == null || !X.exists()) {
                    d = -1;
                    a(i2, displayHeight, true);
                } else {
                    int i3 = X.getBounds().top;
                    int i4 = X.getBounds().bottom;
                    if (i3 <= i2 || i4 >= displayHeight) {
                        e.remove(e.size() - 1);
                        d = -1;
                        a(i2, displayHeight, true);
                    } else {
                        c.d(X);
                        c.c();
                        j();
                    }
                }
                i++;
            } else {
                return;
            }
        }
    }

    private UiObject X() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/float_header", 1);
        if (findByResId == null || !findByResId.exists()) {
            findByResId = findText("综合", 1);
            if (findByResId == null || !findByResId.exists()) {
                findByResId = findText("销量", 1);
                if (findByResId != null && findByResId.exists()) {
                }
            }
        }
        return findByResId;
    }

    private UiObject Y() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/shop_homepage_buttom_custom_menu", 1);
        if (findByResId == null || !findByResId.exists()) {
            findByResId = findText("宝贝分类", 1);
            if (findByResId == null || !findByResId.exists()) {
                findByResId = findText("店铺简介", 1);
                if (findByResId != null && findByResId.exists()) {
                }
            }
        }
        return findByResId;
    }

    private void Z() throws UiObjectNotFoundException {
        UiScrollable findScroll = findScroll();
        if (findScroll == null || !findScroll.exists()) {
            c.e();
            return;
        }
        for (int i = 0; i < 5; i++) {
            if (j.nextInt(HttpStatus.SC_BAD_REQUEST) > 100) {
                simpleDragScroll(true, 3);
            } else {
                simpleDragScroll(false, 3);
            }
            c.c();
        }
    }

    private UiObject a(String str, String str2, String str3, String str4) throws UiObjectNotFoundException {
        int i;
        b.b(" start to find uiobject ...:" + this.searchParams.getShopName(), new Object[0]);
        UiObject findBackToTopBtn = findBackToTopBtn();
        if (findBackToTopBtn.exists()) {
            c.c(findBackToTopBtn);
            c.e();
        }
        int i2 = 3;
        while (true) {
            i = i2 - 1;
            if (i2 <= 0) {
                break;
            }
            b.b(" wait for item main page loading : at round " + i, new Object[0]);
            findBackToTopBtn = findByResId("com.taobao.taobao:id/action_bar_content_layout", 1);
            if (!findBackToTopBtn.exists()) {
                findBackToTopBtn = findByResId("com.taobao.taobao:id/pagegroup", 1);
            }
            b.b(" found item detail page...?>??:" + findBackToTopBtn.exists(), new Object[0]);
            debugUiObject(findBackToTopBtn);
            if (findBackToTopBtn.exists()) {
                break;
            }
            c.e();
            i2 = i;
        }
        Rect visibleBounds = findScroll().getVisibleBounds();
        i = this.device.getDisplayWidth() / 2;
        int i3 = ((visibleBounds.bottom * 3) + visibleBounds.top) / 4;
        int i4 = ((visibleBounds.top * 3) + visibleBounds.bottom) / 4;
        i2 = 3;
        while (true) {
            int i5 = i2 - 1;
            if (i2 <= 0) {
                return null;
            }
            b.b(" shop title swipe down times :" + (4 - i5), new Object[0]);
            c.b();
            findBackToTopBtn = findByResId(str, 1);
            if (findBackToTopBtn == null || !findBackToTopBtn.exists()) {
                findBackToTopBtn = findTextViewContains(str2, 1);
            }
            if (findBackToTopBtn == null || !findBackToTopBtn.exists()) {
                findBackToTopBtn = findTextContain(str4, 1);
            }
            if (findBackToTopBtn == null || !findBackToTopBtn.exists()) {
                findBackToTopBtn = new UiObject(new UiSelector().description(str3));
            }
            if (findBackToTopBtn == null || !findBackToTopBtn.exists()) {
                c.a(this.device, i, i3, i, i4, 60);
                i2 = i5;
            } else {
                b.b(" find shop title obj :" + findBackToTopBtn, new Object[0]);
                return findBackToTopBtn;
            }
        }
    }

    private void a(int i, int i2, boolean z) throws UiObjectNotFoundException {
        int displayWidth = this.device.getDisplayWidth() / 2;
        int i3 = ((i2 * 3) + i) / 4;
        int i4 = ((i * 7) + i2) / 8;
        int nextInt = j.nextInt(20) + 20;
        if (!z) {
            i4 = ((i2 * 3) + i) / 4;
            i3 = ((i * 7) + i2) / 8;
        }
        c.a(this.device, displayWidth, i3, displayWidth, i4, nextInt);
        c.c();
    }

    private void a(int i, boolean z, boolean z2) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i <= WorkStatus.ItemViewMainPage) {
            if (i == WorkStatus.ItemViewMainPage) {
                UiScrollable findScroll = findScroll();
                if (findScroll.exists()) {
                    a(findScroll);
                }
            }
            a(null, z, z2);
        }
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private void a(java.lang.String r11, int r12, int r13) throws com.android.uiautomator.core.UiObjectNotFoundException, com.sutuijingling.result.c {
        /*
        r10 = this;
        r0 = i;
        r2 = 0;
        r3 = 0;
        r4 = r0;
        r1 = r12;
        r0 = r13;
    L_0x0007:
        r5 = r4 + -1;
        if (r4 <= 0) goto L_0x00dd;
    L_0x000b:
        r3 = r10.b(r11);
        if (r3 == 0) goto L_0x0076;
    L_0x0011:
        r4 = r3.exists();
        if (r4 == 0) goto L_0x0076;
    L_0x0017:
        r4 = r3.getBounds();
        r4 = r4.bottom;
        r6 = r3.getBounds();
        r6 = r6.top;
        r7 = r10.n();
        if (r7 == 0) goto L_0x003b;
    L_0x0029:
        r8 = r7.exists();
        if (r8 == 0) goto L_0x003b;
    L_0x002f:
        r0 = r7.getBounds();
        r1 = r0.top;
        r0 = r7.getBounds();
        r0 = r0.bottom;
    L_0x003b:
        r7 = new com.android.uiautomator.core.UiScrollable;
        r8 = new com.android.uiautomator.core.UiSelector;
        r8.<init>();
        r9 = 1;
        r8 = r8.scrollable(r9);
        r7.<init>(r8);
        if (r4 <= r0) goto L_0x0060;
    L_0x004c:
        r4 = r7.exists();
        if (r4 == 0) goto L_0x005a;
    L_0x0052:
        r4 = 60;
        r7.scrollForward(r4);
    L_0x0057:
        r4 = r5 + 1;
        goto L_0x0007;
    L_0x005a:
        r4 = 1;
        r6 = 4;
        r10.simpleDragScroll(r4, r6);
        goto L_0x0057;
    L_0x0060:
        if (r6 >= r1) goto L_0x00dd;
    L_0x0062:
        r4 = r7.exists();
        if (r4 == 0) goto L_0x0070;
    L_0x0068:
        r4 = 60;
        r7.scrollForward(r4);
    L_0x006d:
        r4 = r5 + 1;
        goto L_0x0007;
    L_0x0070:
        r4 = 0;
        r6 = 4;
        r10.simpleDragScroll(r4, r6);
        goto L_0x006d;
    L_0x0076:
        r4 = new com.android.uiautomator.core.UiScrollable;
        r6 = new com.android.uiautomator.core.UiSelector;
        r6.<init>();
        r7 = 1;
        r6 = r6.scrollable(r7);
        r4.<init>(r6);
        r6 = r4.exists();
        if (r6 != 0) goto L_0x00b5;
    L_0x008b:
        r0 = r3;
    L_0x008c:
        if (r0 == 0) goto L_0x0094;
    L_0x008e:
        r1 = r0.exists();
        if (r1 != 0) goto L_0x00d3;
    L_0x0094:
        r0 = new com.sutuijingling.result.c;
        r1 = 404; // 0x194 float:5.66E-43 double:1.996E-321;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "找不到小号：";
        r2 = r2.append(r3);
        r2 = r2.append(r11);
        r3 = " 的评价！";
        r2 = r2.append(r3);
        r2 = r2.toString();
        r0.<init>(r1, r2);
        throw r0;
    L_0x00b5:
        r6 = r5 % 2;
        if (r6 != 0) goto L_0x00c4;
    L_0x00b9:
        r4 = 1;
        r6 = 4;
        r10.simpleDragScroll(r4, r6);
    L_0x00be:
        com.sutuijingling.utils.c.c();
        r4 = r5;
        goto L_0x0007;
    L_0x00c4:
        r6 = 50;
        r4 = r4.scrollForward(r6);
        if (r4 != 0) goto L_0x00be;
    L_0x00cc:
        r2 = r2 + 1;
        r4 = 2;
        if (r2 <= r4) goto L_0x00be;
    L_0x00d1:
        r0 = r3;
        goto L_0x008c;
    L_0x00d3:
        com.sutuijingling.utils.c.c(r0);
        com.sutuijingling.utils.c.f();
        r10.aa();
        return;
    L_0x00dd:
        r0 = r3;
        goto L_0x008c;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sutuijingling.a.i.a(java.lang.String, int, int):void");
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private void a(java.util.List r14, int r15, int r16) throws com.android.uiautomator.core.UiObjectNotFoundException, com.sutuijingling.result.c {
        /*
        r13 = this;
        r0 = i;
        r3 = 0;
        r4 = 0;
        r6 = new java.util.ArrayList;
        r6.<init>();
        r2 = r0;
        r1 = r15;
        r0 = r16;
    L_0x000d:
        r5 = r2 + -1;
        if (r2 <= 0) goto L_0x014d;
    L_0x0011:
        r7 = r13.a(r14, r6);
        if (r7 == 0) goto L_0x010a;
    L_0x0017:
        r2 = r7.exists();
        if (r2 == 0) goto L_0x010a;
    L_0x001d:
        r2 = r7.getBounds();
        r8 = r2.bottom;
        r2 = r7.getBounds();
        r9 = r2.top;
        r2 = r13.n();
        if (r2 == 0) goto L_0x0149;
    L_0x002f:
        r10 = r2.exists();
        if (r10 == 0) goto L_0x0149;
    L_0x0035:
        r0 = r2.getBounds();
        r1 = r0.top;
        r0 = r2.getBounds();
        r0 = r0.bottom;
        r2 = r1;
        r1 = r0;
    L_0x0043:
        r0 = new com.android.uiautomator.core.UiScrollable;
        r10 = new com.android.uiautomator.core.UiSelector;
        r10.<init>();
        r11 = 1;
        r10 = r10.scrollable(r11);
        r0.<init>(r10);
        if (r8 <= r1) goto L_0x006c;
    L_0x0054:
        r7 = r0.exists();
        if (r7 == 0) goto L_0x0066;
    L_0x005a:
        r7 = 60;
        r0.scrollForward(r7);
    L_0x005f:
        r0 = r5 + 1;
        r12 = r0;
        r0 = r1;
        r1 = r2;
        r2 = r12;
        goto L_0x000d;
    L_0x0066:
        r0 = 1;
        r7 = 4;
        r13.simpleDragScroll(r0, r7);
        goto L_0x005f;
    L_0x006c:
        if (r9 >= r2) goto L_0x0086;
    L_0x006e:
        r7 = r0.exists();
        if (r7 == 0) goto L_0x0080;
    L_0x0074:
        r7 = 60;
        r0.scrollForward(r7);
    L_0x0079:
        r0 = r5 + 1;
        r12 = r0;
        r0 = r1;
        r1 = r2;
        r2 = r12;
        goto L_0x000d;
    L_0x0080:
        r0 = 0;
        r7 = 4;
        r13.simpleDragScroll(r0, r7);
        goto L_0x0079;
    L_0x0086:
        com.sutuijingling.utils.c.c(r7);
        com.sutuijingling.utils.c.f();
        r13.aa();
        r4 = r4 + 1;
        r0 = r7.getText();
        r7 = r13.h(r0);
        r8 = r14.iterator();
    L_0x009d:
        r0 = r8.hasNext();
        if (r0 == 0) goto L_0x00d5;
    L_0x00a3:
        r0 = r8.next();
        r0 = (java.lang.String) r0;
        r9 = r13.h(r0);
        r9 = r9.equals(r7);
        if (r9 == 0) goto L_0x009d;
    L_0x00b3:
        r9 = java.lang.System.out;
        r10 = new java.lang.StringBuilder;
        r10.<init>();
        r11 = "已点赞：";
        r10 = r10.append(r11);
        r10 = r10.append(r0);
        r11 = "的评价!";
        r10 = r10.append(r11);
        r10 = r10.toString();
        r9.println(r10);
        r6.add(r0);
        goto L_0x009d;
    L_0x00d5:
        r0 = r6.size();
        r7 = r14.size();
        if (r0 < r7) goto L_0x0144;
    L_0x00df:
        r0 = r4;
    L_0x00e0:
        r1 = java.lang.System.out;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "成功点赞 ";
        r2 = r2.append(r3);
        r2 = r2.append(r0);
        r3 = " 个评价！";
        r2 = r2.append(r3);
        r2 = r2.toString();
        r1.println(r2);
        if (r0 > 0) goto L_0x0141;
    L_0x0100:
        r0 = new com.sutuijingling.result.c;
        r1 = 404; // 0x194 float:5.66E-43 double:1.996E-321;
        r2 = "点赞失败，找不到评价！";
        r0.<init>(r1, r2);
        throw r0;
    L_0x010a:
        r2 = new com.android.uiautomator.core.UiScrollable;
        r7 = new com.android.uiautomator.core.UiSelector;
        r7.<init>();
        r8 = 1;
        r7 = r7.scrollable(r8);
        r2.<init>(r7);
        r7 = r2.exists();
        if (r7 != 0) goto L_0x0121;
    L_0x011f:
        r0 = r4;
        goto L_0x00e0;
    L_0x0121:
        r7 = r5 % 2;
        if (r7 != 0) goto L_0x0132;
    L_0x0125:
        r2 = 1;
        r7 = 4;
        r13.simpleDragScroll(r2, r7);
        r2 = r3;
    L_0x012b:
        com.sutuijingling.utils.c.c();
        r3 = r2;
        r2 = r5;
        goto L_0x000d;
    L_0x0132:
        r7 = 50;
        r2 = r2.scrollForward(r7);
        if (r2 != 0) goto L_0x0142;
    L_0x013a:
        r2 = r3 + 1;
        r3 = 2;
        if (r2 <= r3) goto L_0x012b;
    L_0x013f:
        r0 = r4;
        goto L_0x00e0;
    L_0x0141:
        return;
    L_0x0142:
        r2 = r3;
        goto L_0x012b;
    L_0x0144:
        r0 = r1;
        r1 = r2;
        r2 = r5;
        goto L_0x000d;
    L_0x0149:
        r2 = r1;
        r1 = r0;
        goto L_0x0043;
    L_0x014d:
        r0 = r4;
        goto L_0x00e0;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sutuijingling.a.i.a(java.util.List, int, int):void");
    }

    public static void a(boolean z) {
        String str = "/data/local/tmp/storeup.txt";
        a.a(str, String.valueOf(z));
        a.b(" chmod 777 " + str);
    }

    private void aa() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        UiObject l = l();
        if (!l.exists()) {
            c.e();
            l = l();
        }
        if (l.exists()) {
            UiScrollable findScroll = findScroll();
            if (findScroll == null || !findScroll.exists()) {
                c.e();
            } else {
                for (int i = 0; i < 3; i++) {
                    simpleDragScroll(true, 3);
                    c.c();
                }
            }
            c.c(l);
            c.f();
            this.device.pressBack();
            return;
        }
        throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "没有点赞按钮，怎么回事！");
    }

    private void ab() throws com.sutuijingling.result.c, UiObjectNotFoundException {
        w.a(this.missionId, (int) WorkStatus.SearchTypeInput);
        checkNewVersionTip();
        checkLocationMock();
        checkStopTBTip();
        checkAppIsCode();
        UiObject uiObject = new UiObject(new UiSelector().className(EditText.class));
        ensureExist(uiObject, " 没有搜索 输入框,是不是走错方向了???");
        c.c(uiObject);
        c.c();
        UiObject findByResId = findByResId("com.taobao.taobao:id/edit_del_btn", 1);
        if (findByResId.exists()) {
            c.c(findByResId);
            c.d();
        }
        ensureInput(uiObject, this.searchParams.getKeyword());
        System.out.println(" ensure input over sleep [1s]");
        checkAppIsCode();
        uiObject = findByResId("com.taobao.taobao:id/searchbtn", 1);
        if (!uiObject.exists()) {
            uiObject = findText("搜索", 1);
        }
        ensureExist(uiObject, " No Search btn????");
        c.d(uiObject);
    }

    private int ac() {
        if (m > 0) {
            return m;
        }
        try {
            if (new File(l).exists()) {
                String replace = a.a(l).trim().replace("%0A", "");
                if (org.apache.commons.lang.c.a(replace) || !org.apache.commons.lang.c.d(replace)) {
                    m = i;
                    return m;
                }
                m = Integer.parseInt(replace);
                if (m <= 0) {
                    m = i;
                }
                return m;
            }
            m = i;
            return m;
        } catch (Exception e) {
            e.printStackTrace();
            return i;
        }
    }

    private int ad() {
        if (o > 0) {
            return o;
        }
        try {
            if (new File(n).exists()) {
                String replace = a.a(n).trim().replace("%0A", "");
                if (org.apache.commons.lang.c.a(replace) || !org.apache.commons.lang.c.d(replace)) {
                    o = i;
                    return o;
                }
                o = Integer.parseInt(replace);
                if (o <= 0) {
                    o = i;
                }
                return o;
            }
            o = i;
            return o;
        } catch (Exception e) {
            e.printStackTrace();
            return i;
        }
    }

    private int ae() {
        if (t > 0) {
            return t;
        }
        try {
            if (new File(s).exists()) {
                String replace = a.a(s).trim().replace("%0A", "");
                if (org.apache.commons.lang.c.a(replace) || !org.apache.commons.lang.c.d(replace)) {
                    t = i;
                    return t;
                }
                t = Integer.parseInt(replace);
                if (t <= 0) {
                    t = i;
                }
                return t;
            }
            t = i;
            return t;
        } catch (Exception e) {
            e.printStackTrace();
            return i;
        }
    }

    private boolean af() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        c.c();
        checkLocationMock();
        checkAppIsCode();
        if (findByResId("com.taobao.taobao:id/sortbar_filter_icon", 1).exists() || findByResId("com.taobao.taobao:id/search_headertips_text", 1).exists()) {
        }
        if (this.x) {
            if (this.y == 1) {
                I();
            } else {
                ai();
            }
        }
        System.out.println(" start to find <filter> 筛选");
        checkNewVersionTip();
        checkStopTBTip();
        checkBiaoqianTip();
        A();
        B();
        checkSameTip();
        UiObject findByResId = findByResId("com.taobao.taobao:id/filter_img_upanddown", 1);
        if (!findByResId.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/btn_sortbar_filter_text", 1);
        }
        if (!findByResId.exists()) {
            findByResId = findTextView("筛选", 1);
        }
        if (findByResId.exists()) {
            c.d(findByResId);
            b.b(" filter has been clicked", new Object[0]);
            return true;
        }
        findByResId = findTextView("筛选", 1);
        c.c();
        System.out.println(" check my taobao page...");
        boolean isTaobaoMainPage = isTaobaoMainPage();
        System.out.println(" is mai taobao page:" + isTaobaoMainPage);
        if (isTaobaoMainPage) {
            this.x = true;
            this.y++;
            System.out.println("back to home search page...we have to redo...:" + this.y);
            if (this.y > 3) {
                o();
                p();
            } else {
                o();
                p();
            }
            return false;
        }
        A();
        B();
        UiObject uiObject = findByResId;
        int i = 0;
        while (true) {
            int i2 = i + 1;
            if (i >= 3) {
                break;
            }
            boolean exists = uiObject.exists();
            b.b(" filter exists count :" + i2 + " for filter btn exists:" + exists, new Object[0]);
            if (exists) {
                break;
            }
            c.e();
            findByResId = findByResId("com.taobao.taobao:id/sortbar_filter_icon", 1);
            if (!findByResId.exists()) {
                findByResId = findTextView("筛选", 1);
            }
            uiObject = findByResId;
            i = i2;
        }
        debugUiObject(uiObject);
        c.d(uiObject);
        b.b(" filter has been clicked", new Object[0]);
        return true;
    }

    private void ag() throws UiObjectNotFoundException {
        boolean exists;
        UiObject findByResId = findByResId("com.taobao.taobao:id/service_expand_btn_icon", 1);
        if (findByResId != null && findByResId.exists()) {
            c.c(findByResId);
            c.d();
        }
        boolean isMobileSpecial = this.searchParams.isMobileSpecial();
        b.b(" is mobile special :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("手机专享", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                c.d(findByResId);
            }
        }
        isMobileSpecial = this.searchParams.isGoldMoney();
        b.b(" is golden money :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("淘金币抵钱", false);
            exists = findByResId.exists();
            b.b(" is btn gold money exists???:" + exists, new Object[0]);
            if (exists) {
                c.c(findByResId);
            }
        }
        isMobileSpecial = this.searchParams.isFreeDelivery();
        b.b(" is free delivery :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("包邮", false);
            if (findByResId == null || findByResId.exists()) {
                findByResId = a("免运费", false);
            }
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                c.c(findByResId);
            }
        }
        isMobileSpecial = this.searchParams.isTianmao();
        b.b(" is tianmao :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("天猫", true);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
        isMobileSpecial = this.searchParams.isGlobleSale();
        b.b(" is globleSale :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("全球购", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
        isMobileSpecial = this.searchParams.isCustomProtected();
        b.b(" is customProtected :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("消费者保障", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
        isMobileSpecial = this.searchParams.isQitiantuihuo();
        b.b(" is qtiantuihuo :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("7+天内退货", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
        isMobileSpecial = this.searchParams.isHuabeifenqi();
        b.b(" is isHuabeifenqi :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("花呗分期", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
        isMobileSpecial = this.searchParams.isHuodaofukuai();
        b.b(" is isHuodaofukuai :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("货到付款", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
        isMobileSpecial = this.searchParams.isTongyongpaixu();
        b.b(" is isTongyongpaixu :" + isMobileSpecial, new Object[0]);
        if (isMobileSpecial) {
            findByResId = a("通用排序", false);
            exists = findByResId.exists();
            b.b(" is btn exists???:" + exists, new Object[0]);
            if (exists) {
                findByResId.click();
            }
        }
    }

    private void ah() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (this.searchParams.hasPriceInterval()) {
            UiObject findByResId = findByResId("com.taobao.taobao:id/min_price", 2);
            if (!findByResId.exists()) {
                findByResId = findByResId("com.taobao.taobao:id/tbsearch_filter_edit_min_price", 1);
            }
            if (!findByResId.exists()) {
                findByResId = new UiObject(new UiSelector().className(EditText.class).instance(0));
            }
            UiObject findByResId2 = findByResId("com.taobao.taobao:id/max_price", 2);
            if (!findByResId2.exists()) {
                findByResId2 = findByResId("com.taobao.taobao:id/tbsearch_filter_edit_max_price", 1);
            }
            if (!findByResId2.exists()) {
                findByResId2 = new UiObject(new UiSelector().className(EditText.class).instance(1));
            }
            this.searchParams.trimPrice();
            if (!org.apache.commons.lang.c.a(this.searchParams.getMinPrice())) {
                ensureInput(findByResId, this.searchParams.getMinPrice(), true);
            }
            if (!org.apache.commons.lang.c.a(this.searchParams.getMaxPrice())) {
                ensureInput(findByResId2, this.searchParams.getMaxPrice(), true);
            }
            if (F()) {
                findByResId = findByResId("com.taobao.taobao:id/filter_finish", 1);
                if (!findByResId.exists()) {
                    findByResId = findText("完成", 1);
                }
                if (findByResId.exists()) {
                    c.c(findByResId);
                    c.d();
                    af();
                }
            }
        }
    }

    private void ai() {
        int displayWidth = this.device.getDisplayWidth();
        try {
            c.a(this.device, ((displayWidth - 50) * this.device.getDisplayWidth()) / displayWidth, 100);
        } catch (UiObjectNotFoundException e) {
            e.printStackTrace();
        }
    }

    private UiObject aj() throws UiObjectNotFoundException {
        return a("com.taobao.taobao:id/detail_main_seller_shopcategory", "查看宝贝分类", "store-list 查看宝贝分类 Link", "查看分类");
    }

    private UiObject ak() throws UiObjectNotFoundException {
        return a("com.taobao.taobao:id/detail_main_seller_title", "进店逛逛", "进入店铺 Link", "进店逛逛");
    }

    public static void b(boolean z) {
        String str = "/data/local/tmp/shopstore";
        a.a(str, String.valueOf(z));
        a.b(" chmod 777 " + str);
    }

    private boolean b(String str, String str2) {
        if (str2.equals(str)) {
            return true;
        }
        if (str.contains("+")) {
            int indexOf = str.indexOf("+");
            String substring = str.substring(0, indexOf);
            String substring2 = str.substring(indexOf + 1);
            if (str2.equals(substring) || str2.equals(substring2)) {
                return true;
            }
        }
        return false;
    }

    private void d(UiObject uiObject) throws UiObjectNotFoundException {
        c.d(uiObject);
        c.c();
        c = false;
        boolean isShopStore = this.searchParams.isShopStore();
        System.out.println("is need store shop:" + isShopStore);
        if (isShopStore) {
            c = S();
        }
        if (isShopStore && !c) {
            c = S();
        }
        System.out.println(" store shop result:" + c);
        b(c);
        l(null);
        if (this.searchParams.isVisitOtherItem()) {
            W();
        }
        this.device.pressBack();
    }

    private void e(UiObject uiObject) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        c.d(uiObject);
        c.d();
        boolean isDianzan = this.searchParams.isDianzan();
        String dianzanNicks = this.searchParams.getDianzanNicks();
        if (!isDianzan || org.apache.commons.lang.c.a(dianzanNicks)) {
            Z();
        } else {
            a(dianzanNicks);
        }
        this.device.pressBack();
        c.c();
    }

    private String h(String str) {
        String trim = str.trim();
        return trim.length() > 2 ? trim.substring(0, 1) + trim.substring(trim.length() - 1) : trim;
    }

    private UiObject i(String str) throws UiObjectNotFoundException {
        UiObject uiObject = null;
        UiObject findByResId = findByResId("com.taobao.taobao:id/city_grid_view", 1);
        if (findByResId.exists()) {
            uiObject = findByResId.getChild(new UiSelector().text(str));
        }
        if (uiObject == null || !uiObject.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/province_grid_view", 1);
            if (findByResId.exists()) {
                uiObject = findByResId.getChild(new UiSelector().text(str));
            }
        }
        if (uiObject == null || !uiObject.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/location_layout", 1);
            if (findByResId.exists()) {
                uiObject = findByResId.getChild(new UiSelector().text(str));
            }
        }
        if (uiObject != null && uiObject.exists()) {
            return uiObject;
        }
        findByResId = findByResId("com.taobao.taobao:id/filter_layout", 1);
        return findByResId.exists() ? findByResId.getChild(new UiSelector().text(str)) : uiObject;
    }

    private void i(int i) throws UiObjectNotFoundException {
        if (i > WorkStatus.ItemViewAllItems) {
            b.b(" no need to view all itmems  :" + i, new Object[0]);
            return;
        }
        if (i == WorkStatus.ItemViewAllItems) {
            if (isShopHomePage()) {
                this.device.pressBack();
            } else if (isItemDetail()) {
                a(findScroll());
            }
        }
        if (this.searchParams.isTaokeItem()) {
            if (isSearchPage()) {
                this.device.pressBack();
                c.d();
            }
            if (isHomePage()) {
                this.device.pressBack();
                c.b();
                this.device.pressBack();
                c.c();
            }
        }
        if (this.searchParams.isVisitAllItems()) {
            h();
        }
    }

    private void j(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i > WorkStatus.ItemViewItemCate) {
            b.b(" no need to view item category  :" + i, new Object[0]);
            return;
        }
        if (i == WorkStatus.ItemViewItemCate) {
            if (isItemCatePage()) {
                this.device.pressBack();
            } else if (isItemDetail()) {
                a(findScroll());
            }
        }
        if (this.searchParams.isVisitItemCategory()) {
            j(null);
        }
    }

    private void k(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i > WorkStatus.ItemViewCommentPage) {
            b.b(" no need to view by shopname  :" + i, new Object[0]);
            return;
        }
        if (i == WorkStatus.ItemViewCommentPage) {
            if (isItemCommentPage()) {
                this.device.pressBack();
            } else if (isItemDetail()) {
                a(findScroll());
            }
        }
        if (this.searchParams.isVisitComment()) {
            g(null);
        }
    }

    private void k(UiScrollable uiScrollable) throws UiObjectNotFoundException {
        int i = 0;
        if (uiScrollable == null) {
            uiScrollable = new UiScrollable(new UiSelector().scrollable(true).instance(0));
        }
        if (uiScrollable.exists()) {
            while (i < 3) {
                simpleDragScroll(true);
                c.c();
                i++;
            }
            return;
        }
        c.e();
    }

    private void l(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        c.c();
        if (i > WorkStatus.ItemDoStoreUp) {
            b.b("has stored up", new Object[0]);
            return;
        }
        if (i == WorkStatus.ItemDoStoreUp) {
            if (isItemCommentPage()) {
                this.device.pressBack();
            } else if (isItemDetail()) {
                a(findScroll());
            }
        }
        if (this.searchParams.isTaokeItem()) {
            if (isSearchPage()) {
                this.device.pressBack();
                c.d();
            }
            if (isHomePage()) {
                this.device.pressBack();
                c.b();
                this.device.pressBack();
                c.c();
            }
        }
        h(null);
        M();
    }

    private void l(UiScrollable uiScrollable) throws UiObjectNotFoundException {
        for (int i = 0; i < 3; i++) {
            simpleDragScroll(true);
            c.c();
        }
    }

    private void m(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i > WorkStatus.SearchMatchTitle) {
            b.b(" no need to search match title :" + i, new Object[0]);
            return;
        }
        if (i == WorkStatus.SearchMatchTitle) {
            a(findScroll());
        }
        w();
    }

    private void n(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i <= WorkStatus.SearchTypeInput) {
            if (i == WorkStatus.SearchTypeInput) {
                UiObject uiObject = new UiObject(new UiSelector().className(EditText.class));
                if (uiObject.exists()) {
                    c.c(uiObject);
                }
            }
            ab();
        }
    }

    private void o(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i <= WorkStatus.ItemViewMainPage) {
            if (i == WorkStatus.ItemViewMainPage) {
                UiScrollable findScroll = findScroll();
                if (findScroll.exists()) {
                    a(findScroll);
                }
            }
            d();
        }
    }

    private void p(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (isItemCatePage()) {
            this.device.pressBack();
        }
        if (this.searchParams.isViewFirstShop()) {
            c(null);
        }
    }

    private void q(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i <= WorkStatus.SearchFilter) {
            b.b("view item current status :" + i, new Object[0]);
            if (i == WorkStatus.SearchFilter) {
                b.b(" recover from filter.... ", new Object[0]);
                if (findText("完成", 2).exists()) {
                    this.device.pressBack();
                }
                if (findText("确认", 2).exists()) {
                    this.device.pressBack();
                }
            }
            UiObject findByResId = findByResId("com.taobao.taobao:id/searchbtn", 1);
            if (!findByResId.exists()) {
                findByResId = findText("搜索", 1);
            }
            if (findByResId.exists()) {
                c.c(findByResId);
                c.f();
            }
            q();
        }
    }

    private void r(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (i <= WorkStatus.EnterSearchPage) {
            b.b("enter search page current status :" + i, new Object[0]);
            if (i == WorkStatus.EnterSearchPage) {
                b.b(" recover from enter search page..", new Object[0]);
                if (isHoloLauncher()) {
                    doOpenMyTaobao(this.device);
                } else if (isSearchResultPage()) {
                    this.device.pressBack();
                    c.c();
                }
                int i2 = 3;
                while (!isMyTaobao()) {
                    int i3 = i2 - 1;
                    if (i2 <= 0) {
                        break;
                    }
                    this.device.pressBack();
                    i2 = i3;
                }
            }
            o();
        }
    }

    public void A() throws UiObjectNotFoundException {
        UiObject findText = findText("下一步", 1);
        System.out.println(" check  has next tip....." + findText);
        if (findText == null || !findText.exists()) {
            findText = findByResId("com.taobao.taobao:id/nextPageBtn", 1);
        }
        if (findText != null && findText.exists()) {
            UiObject findByResId = findByResId("com.taobao.taobao:id/closeBtn", 1);
            if (findByResId == null || !findByResId.exists()) {
                int i = 0;
                while (i < 5 && findText != null && findText.exists()) {
                    c.c(findText);
                    c.d();
                    i++;
                    findText = findByResId("com.taobao.taobao:id/nextPageBtn", 1);
                }
                return;
            }
            c.c(findByResId);
            c.d();
        }
    }

    protected void B() throws UiObjectNotFoundException {
        UiObject findText = findText("马上体验新版搜索", 1);
        System.out.println(" check  has next tip....." + findText);
        if (findText != null && findText.exists()) {
            c.c(findText);
            c.d();
        }
    }

    public UiObject C() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/filter_img_upanddown", 1);
        if (findByResId != null && findByResId.exists()) {
            return findByResId;
        }
        findByResId = findByResId("com.taobao.taobao:id/btn_sortbar_filter_text", 1);
        return (findByResId == null || !findByResId.exists()) ? findText("筛选", 1) : findByResId;
    }

    public boolean D() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        UiObject findByResId;
        checkLocationMock();
        checkAppIsCode();
        System.out.println(" start to check price editor....");
        int i = 0;
        while (true) {
            int i2 = i + 1;
            if (i >= 8) {
                break;
            }
            boolean exists = findByResId("com.taobao.taobao:id/location_expand_btn", 1).exists();
            if (!exists) {
                exists = findByResId("com.taobao.taobao:id/tbsearch_filter_location_expand_btn", 1).exists();
            }
            boolean exists2 = findByResId("com.taobao.taobao:id/price_edit_area", 1).exists();
            if (!exists2) {
                exists2 = findTextViewContains("价格区间", 1).exists();
            }
            if (!exists2) {
                exists2 = findByResId("com.taobao.taobao:id/filter_price_title", 1).exists();
            }
            b.b(" check location exist: [" + exists2 + "] with round [" + i2 + "]", new Object[0]);
            if (exists || exists2) {
                break;
            } else if (i2 < 4) {
                findByResId = findByResId("com.taobao.taobao:id/filter_img_upanddown", 1);
                if (!findByResId.exists()) {
                    findByResId = findByResId("com.taobao.taobao:id/btn_sortbar_filter_text", 1);
                }
                if (!findByResId.exists()) {
                    findByResId = findTextView("筛选", 1);
                }
                if (findByResId.exists()) {
                    c.c(findByResId);
                    c.e();
                }
                c.c();
                i = i2;
            } else {
                if (i2 % 3 == 0) {
                    findByResId = findScroll();
                    if (findByResId != null && findByResId.exists()) {
                        Rect visibleBounds = findByResId.getVisibleBounds();
                        int displayWidth = this.device.getDisplayWidth() / 4;
                        c.a(this.device, displayWidth, ((visibleBounds.bottom * 3) + visibleBounds.top) / 4, j.nextInt(displayWidth / 2) + displayWidth, ((visibleBounds.top * 7) + visibleBounds.bottom) / 8, j.nextInt(20) + 20);
                    }
                }
                i = i2;
            }
        }
        ah();
        if (!this.searchParams.isZhiTongChe()) {
            ag();
        }
        H();
        System.out.println(" end input.... start to click wancheng...");
        findByResId = findByResId("com.taobao.taobao:id/filter_confirm_btn", 1);
        if (!findByResId.exists()) {
            findByResId = findText("确认", 1);
        }
        if (!findByResId.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/filter_finish", 1);
        }
        if (!findByResId.exists()) {
            findByResId = findText("完成", 2);
        }
        c.c();
        if (findByResId.exists()) {
        }
        if (findByResId.exists()) {
            System.out.println(" start to finish the price search.....");
            c.d(findByResId);
            System.out.println(" end finish the price search.....");
        }
        return true;
    }

    public UiObject E() {
        UiObject findByResId = findByResId("com.taobao.taobao:id/location_expand_btn", 1);
        if (findByResId == null || !findByResId.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/tbsearch_filter_location_expand_btn", 1);
            if (findByResId == null || !findByResId.exists()) {
                findByResId = findByResId("com.taobao.taobao:id/tbsearch_filter_location_title_container", 1);
                if (findByResId != null && findByResId.exists()) {
                }
            }
        }
        return findByResId;
    }

    public boolean F() {
        UiObject findByResId = findByResId("com.taobao.taobao:id/tbsearch_filter_edit_max_price", 1);
        if (findByResId != null && findByResId.exists()) {
            return true;
        }
        findByResId = findByResId("com.taobao.taobao:id/tbsearch_filter_location_expand_btn", 1);
        return findByResId != null && findByResId.exists();
    }

    public void G() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/filter_confirm_btn", 1);
        if (!findByResId.exists()) {
            findByResId = findText("确定", 1);
        }
        if (!findByResId.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/filter_finish", 1);
        }
        if (!findByResId.exists()) {
            findByResId = findText("完成", 1);
        }
        if (findByResId.exists()) {
            c.c(findByResId);
            c.e();
        }
    }

    public void H() throws UiObjectNotFoundException {
        if (this.searchParams.hasArea()) {
            Rect visibleBounds;
            int i;
            int i2;
            int displayHeight = this.device.getDisplayHeight() - 200;
            UiObject findByResId = findByResId("com.taobao.taobao:id/filter_confirm_btn", 1);
            if (!findByResId.exists()) {
                findByResId = findText("确定", 1);
            }
            if (!findByResId.exists()) {
                findByResId = findByResId("com.taobao.taobao:id/filter_finish", 1);
            }
            if (!findByResId.exists()) {
                findByResId = findText("完成", 1);
            }
            int i3 = findByResId.exists() ? findByResId.getBounds().top : displayHeight;
            UiObject findScroll = findScroll();
            findByResId = E();
            if ((!findByResId.exists() || findByResId.getBounds().bottom >= i3) && findScroll != null && findScroll.exists()) {
                visibleBounds = findScroll.getVisibleBounds();
                displayHeight = this.device.getDisplayWidth() / 2;
                i = ((visibleBounds.bottom * 3) + visibleBounds.top) / 4;
                i2 = ((visibleBounds.top * 7) + visibleBounds.bottom) / 8;
                int i4 = 0;
                while (true) {
                    int i5 = i4 + 1;
                    if (i4 >= 4) {
                        break;
                    }
                    c.a(this.device, displayHeight, i, displayHeight, i2, 30);
                    c.c();
                    findByResId = E();
                    if (findByResId.exists() && findByResId.getBounds().bottom < i3) {
                        break;
                    }
                    i4 = i5;
                }
            } else {
                findByResId = E();
            }
            if (findByResId.exists()) {
                if (!findByResId("com.taobao.taobao:id/location_expand_board", 1).exists()) {
                    c.c(findByResId);
                    c.d();
                }
                String targetArea = this.searchParams.getTargetArea();
                b.b(" try to find... [" + targetArea + "]   >>> ", new Object[0]);
                if (!org.apache.commons.lang.c.a(targetArea)) {
                    findByResId = i(targetArea);
                    UiObject findScroll2 = !findScroll.exists() ? findScroll() : findScroll;
                    if (findByResId == null || !findByResId.exists()) {
                        if (findScroll2 != null && findScroll2.exists()) {
                            visibleBounds = findScroll2.getVisibleBounds();
                            displayHeight = this.device.getDisplayWidth() / 2;
                            i = ((visibleBounds.bottom * 3) + visibleBounds.top) / 4;
                            i2 = ((visibleBounds.top * 7) + visibleBounds.bottom) / 8;
                            b.b(" points [%d, %d], [%d, %d]", Integer.valueOf(displayHeight), Integer.valueOf(i), Integer.valueOf(displayHeight), Integer.valueOf(i2));
                            for (int i6 = 0; i6 < 5; i6++) {
                                b.b(" found area round :" + i6, new Object[0]);
                                c.a(this.device, displayHeight, i, displayHeight, i2, 30);
                                findByResId = i(targetArea);
                                if (findByResId != null && findByResId.exists()) {
                                    if (findByResId.getBounds().bottom < i3) {
                                        break;
                                    }
                                    c.a(this.device, displayHeight, i, displayHeight, i2, 30);
                                    c.c();
                                    findByResId = i(targetArea);
                                }
                                if (findByResId != null && findByResId.exists()) {
                                    break;
                                }
                            }
                        } else {
                            b.b(" no scroll for the current.. ", new Object[0]);
                            return;
                        }
                    } else if (findScroll2 == null || !findScroll2.exists()) {
                        b.b(" no scroll for the current.. ", new Object[0]);
                        return;
                    } else {
                        visibleBounds = findScroll2.getVisibleBounds();
                        displayHeight = this.device.getDisplayWidth() / 2;
                        i = ((visibleBounds.bottom * 3) + visibleBounds.top) / 4;
                        i2 = ((visibleBounds.top * 7) + visibleBounds.bottom) / 8;
                        if (findByResId.getBounds().bottom >= i3) {
                            c.a(this.device, displayHeight, i, displayHeight, i2, 30);
                            c.c();
                            findByResId = i(targetArea);
                        }
                    }
                    debugUiObject(findByResId);
                    if (findByResId == null || !findByResId.exists()) {
                        b.b(" area [" + targetArea + "]not exist...", new Object[0]);
                        return;
                    }
                    c.c(findByResId);
                    c.e();
                    return;
                }
                return;
            }
            b.b(" no expand icon found for the area", new Object[0]);
            G();
            return;
        }
        b.b(" no area params for the area..skip..", new Object[0]);
        G();
    }

    public void I() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        UiObject uiObject = new UiObject(new UiSelector().resourceId("com.taobao.taobao:id/style_img"));
        if (uiObject == null || !uiObject.exists()) {
            uiObject = findDescContains("当前为大图模式", 1);
        }
        if (uiObject == null || !uiObject.exists()) {
            uiObject = findByResId("com.taobao.taobao:id/styleBtn", 1);
        }
        if (uiObject == null || !uiObject.exists()) {
            uiObject = new UiObject(new UiSelector().description("列表模式"));
        }
        if (uiObject != null && uiObject.exists()) {
            c.c(uiObject);
        }
    }

    public void J() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        g(0);
        d(0);
        n(0);
        q(0);
        x();
        c();
        j(0);
        k(0);
        this.device.pressBack();
        c.b();
        this.device.pressBack();
    }

    public void K() {
        new Thread(new Runnable(this) {
            final /* synthetic */ i a;

            {
                this.a = r1;
            }

            public void run() {
                while (true) {
                    try {
                        UiObject findByResId = this.a.findByResId("com.taobao.taobao:id/uik_mdTitle", 1);
                        if (findByResId == null || !findByResId.exists()) {
                            findByResId = this.a.findTextContain("在您并未使用该应用时访问您的位置", 1);
                        }
                        if (findByResId != null && findByResId.exists()) {
                            findByResId = this.a.findByResId("com.taobao.taobao:id/uik_mdButtonDefaultPositive", 1);
                            if (findByResId == null || !findByResId.exists()) {
                                findByResId = this.a.findText("允许", 1);
                            }
                            if (findByResId != null && findByResId.exists()) {
                                c.c(findByResId);
                                c.d();
                            }
                        }
                        findByResId = new UiObject(new UiSelector().text("稍后再说"));
                        if (findByResId != null && findByResId.exists()) {
                            c.c(findByResId);
                            c.d();
                        }
                        String str = "立即下载";
                        findByResId = this.a.findTextContain("更新包大小", 1);
                        if (!findByResId.exists()) {
                            findByResId = this.a.findText(str, 1);
                        }
                        System.out.println(" check  has update btn....." + findByResId);
                        if (findByResId.exists()) {
                            System.out.println(" has update btn!!!.....");
                            findByResId = this.a.findText("取消", 1);
                            if (findByResId.exists()) {
                                c.c(findByResId);
                                c.e();
                            }
                            this.a.checkNetWorkTip();
                            this.a.checkLocationMock();
                            c.d();
                        } else {
                            c.d();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }

    public void L() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        String keyword = this.searchParams.getKeyword();
        a.f(keyword);
        c.f();
        UiObject findText = findText("店铺", 1);
        if (!findText.exists()) {
            c.e();
            findText = findText("店铺", 1);
        }
        if (!findText.exists()) {
            a.f(keyword);
            c.f();
        }
    }

    public void M() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/decor_content_parent", 1);
        UiObject findText = findText("店铺", 1);
        if (findByResId == null || !findByResId.exists()) {
            System.out.println("no store tip cover");
        } else if (findText == null || !findText.exists()) {
            c.a(this.device, this.device.getDisplayWidth() / 2, 100);
            c.d();
        }
    }

    public boolean N() {
        UiObject findByResId = findByResId("com.taobao.taobao:id/auction", 1);
        return (findByResId != null && findByResId.exists()) || hasSearchResultGidMid();
    }

    public void O() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        g(0);
        d(0);
        String keyword = this.searchParams.getKeyword();
        a.f(keyword);
        c.f();
        boolean doViewItem = doViewItem();
        if (!doViewItem) {
            a.f(keyword);
            c.f();
            doViewItem = doViewItem();
        }
        if (!doViewItem) {
            a.f(keyword);
            c.f();
            doViewItem = doViewItem();
        }
        if (doViewItem) {
            this.device.pressBack();
            c.b();
            this.device.pressBack();
            w.a(this.missionId, (int) WorkStatus.NetflowOver);
            return;
        }
        throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "淘宝客进入店铺失败！!");
    }

    public void P() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        int i = 12;
        g(0);
        backToHome(this.device);
        a.e(this.searchParams.getKeyword());
        doOpenTBAndDirectToItem();
        int mainItemSeconds = this.searchParams.getMainItemSeconds();
        if (mainItemSeconds > 0) {
            i = mainItemSeconds < 12 ? mainItemSeconds : mainItemSeconds > 120 ? 120 : mainItemSeconds;
        }
        Q();
        int i2 = 0;
        while (i2 < i) {
            UiObject findByResId;
            int i3;
            c.f();
            if (i2 < 2) {
                Q();
            }
            if (i2 == 3 || i2 == 5) {
                findByResId = findByResId("com.taobao.taobao:id/taolive_favour_switch_btn", 1);
                if (findByResId == null || !findByResId.exists()) {
                    findByResId = findByResId("com.taobao.taobao:id/taolive_favor_icon_default", 1);
                }
                if (findByResId == null || !findByResId.exists()) {
                    findByResId = findByResId("com.taobao.taobao:id/taolive_favor_count", 1);
                }
                System.out.println(" dianzan is exists:" + findByResId.exists());
                if (findByResId != null && findByResId.exists()) {
                    System.out.println(" dianzan !!!");
                    for (i3 = 0; i3 < 5; i3++) {
                        c.c(findByResId);
                        c.b();
                    }
                }
            }
            if (i2 == 6) {
                findByResId = findByResId("com.taobao.taobao:id/taolive_product_switch_btn", 1);
                if (findByResId == null || !findByResId.exists()) {
                    findByResId = findTextContain("宝贝", 1);
                }
                System.out.println(" product Btn is exists:" + findByResId.exists());
                if (findByResId != null && findByResId.exists()) {
                    c.c(findByResId);
                    c.f();
                    i3 = i2 + 1;
                    findByResId = findByResId("com.taobao.taobao:id/listview", 1);
                    UiObject uiObject = (findByResId == null || !findByResId.exists()) ? new UiObject(new UiSelector().className(ScrollView.class)) : findByResId;
                    if (uiObject == null || !uiObject.exists()) {
                        c.f();
                        mainItemSeconds = i3 + 1;
                    } else {
                        for (mainItemSeconds = 0; mainItemSeconds < 3; mainItemSeconds++) {
                            simpleDragScrollWithRect(uiObject.getBounds(), true);
                            c.d();
                        }
                        mainItemSeconds = i3 + 1;
                    }
                    simpleDragScroll(false);
                    c.d();
                    i2 = mainItemSeconds + 1;
                }
            }
            mainItemSeconds = i2;
            i2 = mainItemSeconds + 1;
        }
        boolean isNeedStored = this.searchParams.isNeedStored();
        System.out.println("this item is need to be stored:" + isNeedStored);
        if (isNeedStored) {
            f();
        }
        this.device.pressBack();
        c.b();
        this.device.pressBack();
        w.a(this.missionId, (int) WorkStatus.NetflowOver);
    }

    public void Q() throws UiObjectNotFoundException {
        UiObject findText = findText("我知道了", 1);
        if (findText != null && findText.exists()) {
            c.c(findText);
            c.d();
        }
    }

    public boolean R() throws UiObjectNotFoundException {
        return findByResId("com.taobao.taobao:id/shop_homepage_container_fl", 1).exists() || findByResId("com.taobao.taobao:id/shop_search_result_input_area_tv", 1).exists() || findText("店铺首页", 1).exists() || findText("宝贝分类", 1).exists();
    }

    public boolean S() throws UiObjectNotFoundException {
        UiObject findText = findText("关注", 1);
        if (!findText.exists()) {
            findText = findText("收藏", 1);
        }
        if (!findText.exists()) {
            return false;
        }
        c.c(findText);
        c.e();
        findText = findText("关注", 1);
        if (!findText.exists()) {
            findText = findText("收藏", 1);
        }
        if (findText.exists()) {
            c.c(findText);
            c.e();
        }
        if (findText("已关注", 1).exists()) {
            return true;
        }
        if (findText("已收藏", 1).exists()) {
            return true;
        }
        if (findDescContains("关注成功", 1).exists()) {
            return true;
        }
        findText = findText("宝贝分类", 1);
        UiObject findText2 = findText("店铺简介", 1);
        if (!(findText.exists() || findText2.exists())) {
            findText = new UiObject(new UiSelector().className(ImageView.class));
            if (findText.exists()) {
                Rect bounds = findText.getBounds();
                c.a(this.device, (bounds.right + bounds.left) / 2, bounds.bottom - 10);
                c.e();
            }
        }
        return findText("已关注", 1).exists() ? true : findText("已收藏", 1).exists() ? true : findDescContains("关注成功", 1).exists();
    }

    public void T() throws UiObjectNotFoundException {
        int i;
        UiObject findBackToTopBtn = findBackToTopBtn();
        if (findBackToTopBtn.exists()) {
            c.c(findBackToTopBtn);
            c.d();
        }
        int i2 = 10;
        while (true) {
            i = i2 - 1;
            if (i2 <= 0) {
                break;
            }
            b.b(" wait for item main page loading : at round " + i, new Object[0]);
            findBackToTopBtn = findByResId("com.taobao.taobao:id/action_bar_content_layout", 1);
            if (!findBackToTopBtn.exists()) {
                findBackToTopBtn = findByResId("com.taobao.taobao:id/pagegroup", 1);
            }
            b.b(" found item detail page...?>??:" + findBackToTopBtn.exists(), new Object[0]);
            debugUiObject(findBackToTopBtn);
            if (findBackToTopBtn.exists()) {
                break;
            }
            c.c();
            i2 = i;
        }
        i2 = 4;
        Rect visibleBounds = findScroll().getVisibleBounds();
        int displayWidth = this.device.getDisplayWidth() / 2;
        displayWidth = ((visibleBounds.bottom * 3) + visibleBounds.top) / 4;
        i = ((visibleBounds.top * 3) + visibleBounds.bottom) / 4;
        while (true) {
            i = i2 - 1;
            if (i2 > 0) {
                b.b(" shop title swipe down times :" + (4 - i), new Object[0]);
                c.b();
                findBackToTopBtn = findShopTitleObj();
                if (!findBackToTopBtn.exists()) {
                    findBackToTopBtn = new UiObject(new UiSelector().description(this.searchParams.getShopName() + " Heading"));
                }
                if (!findBackToTopBtn.exists()) {
                    c.a(this.device, true, j.nextInt(10) + 60);
                    i2 = i;
                } else {
                    return;
                }
            }
            return;
        }
    }

    public String U() throws UiObjectNotFoundException {
        int i;
        String contentDescription;
        b.b(" start to find shop name and wait...:" + this.searchParams.getShopName(), new Object[0]);
        UiObject findBackToTopBtn = findBackToTopBtn();
        if (findBackToTopBtn.exists()) {
            c.c(findBackToTopBtn);
            c.d();
        }
        int i2 = 10;
        while (true) {
            i = i2 - 1;
            if (i2 <= 0) {
                break;
            }
            b.b(" wait for item main page loading : at round " + i, new Object[0]);
            findBackToTopBtn = findByResId("com.taobao.taobao:id/action_bar_content_layout", 1);
            if (!findBackToTopBtn.exists()) {
                findBackToTopBtn = findByResId("com.taobao.taobao:id/pagegroup", 1);
            }
            b.b(" found item detail page...?>??:" + findBackToTopBtn.exists(), new Object[0]);
            debugUiObject(findBackToTopBtn);
            if (findBackToTopBtn.exists()) {
                break;
            }
            c.c();
            i2 = i;
        }
        i2 = 4;
        Rect visibleBounds = findScroll().getVisibleBounds();
        int displayWidth = this.device.getDisplayWidth() / 2;
        displayWidth = ((visibleBounds.bottom * 3) + visibleBounds.top) / 4;
        i = ((visibleBounds.top * 3) + visibleBounds.bottom) / 4;
        while (true) {
            i = i2 - 1;
            if (i2 > 0) {
                b.b(" shop title swipe down times :" + (4 - i), new Object[0]);
                c.b();
                findBackToTopBtn = findShopTitleObj();
                if (!findBackToTopBtn.exists()) {
                    findBackToTopBtn = new UiObject(new UiSelector().description(this.searchParams.getShopName() + " Heading"));
                }
                if (!findBackToTopBtn.exists()) {
                    findBackToTopBtn = new UiObject(new UiSelector().descriptionStartsWith(this.searchParams.getShopName()));
                }
                if (findBackToTopBtn.exists()) {
                    break;
                }
                c.a(this.device, true, j.nextInt(10) + 60);
                i2 = i;
            } else {
                return null;
            }
        }
        String trim = findBackToTopBtn.getText().trim();
        if (org.apache.commons.lang.c.a(trim)) {
            contentDescription = findBackToTopBtn.getContentDescription();
            b.b(" found content desc for shop :" + contentDescription, new Object[0]);
            if (!org.apache.commons.lang.c.a(contentDescription)) {
                contentDescription = contentDescription.endsWith(" Heading") ? contentDescription.substring(0, contentDescription.lastIndexOf(32)) : this.searchParams.getShopName();
                b.b(" find shop title obj :" + contentDescription, new Object[0]);
                return contentDescription;
            }
        }
        contentDescription = trim;
        b.b(" find shop title obj :" + contentDescription, new Object[0]);
        return contentDescription;
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public com.android.uiautomator.core.UiObject a(java.lang.String r5, boolean r6) throws com.android.uiautomator.core.UiObjectNotFoundException {
        /*
        r4 = this;
        r2 = 1;
        r0 = "com.taobao.taobao:id/filter_layout";
        r1 = r4.findByResId(r0, r2);
        r0 = "折扣和服务";
        r2 = r4.findText(r0, r2);
        r0 = 0;
        r3 = r1.exists();
        if (r3 == 0) goto L_0x0028;
    L_0x0014:
        r0 = new com.android.uiautomator.core.UiSelector;
        r0.<init>();
        r0 = r0.text(r5);
        r0 = r1.getChild(r0);
        r1 = r0.exists();
        if (r1 == 0) goto L_0x0028;
    L_0x0027:
        return r0;
    L_0x0028:
        r1 = r2.exists();
        if (r1 == 0) goto L_0x0027;
    L_0x002e:
        r0 = new com.android.uiautomator.core.UiSelector;
        r0.<init>();
        r0 = r0.text(r5);
        r0 = r2.getFromParent(r0);
        r1 = r0.exists();
        if (r1 == 0) goto L_0x0027;
    L_0x0041:
        goto L_0x0027;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sutuijingling.a.i.a(java.lang.String, boolean):com.android.uiautomator.core.UiObject");
    }

    public UiObject a(List list, List list2) throws UiObjectNotFoundException {
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/detail_comment_nick");
        for (int i = 0; i < 10; i++) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            if (!uiObject.exists()) {
                break;
            }
            String text = uiObject.getText();
            if (!org.apache.commons.lang.c.a(text)) {
                String h = h(text);
                for (String text2 : list) {
                    if (h(text2).equals(h) && !list2.contains(text2)) {
                        return uiObject;
                    }
                }
                continue;
            }
        }
        return null;
    }

    public void a() {
        try {
            checkNetflowTip();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void a(int i) throws UiObjectNotFoundException {
        int i2 = 0;
        if (y()) {
            int i3;
            UiObject uiObject;
            UiObject findByResId = findByResId("com.taobao.taobao:id/search_header_container", 1);
            int i4 = (findByResId == null || !findByResId.exists()) ? 0 : findByResId.getBounds().bottom;
            UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/sales");
            UiSelector resourceId2 = new UiSelector().resourceId("com.taobao.taobao:id/priceInteger");
            int i5 = 0;
            int i6 = 0;
            for (i3 = 0; i3 < 10; i3++) {
                uiObject = new UiObject(resourceId2.instance(i3));
                if (uiObject == null || !uiObject.exists()) {
                    break;
                }
                i6++;
                if (b(uiObject)) {
                    i5++;
                }
            }
            if (i6 > 1 && i5 > 0) {
                i5 = 0;
                i6 = 0;
                for (i3 = 0; i3 < 10; i3++) {
                    uiObject = new UiObject(resourceId2.instance(i3));
                    if (uiObject == null || !uiObject.exists()) {
                        break;
                    }
                    if (b(uiObject)) {
                        UiObject uiObject2 = new UiObject(resourceId.instance(i3));
                        if (!uiObject2.exists()) {
                            break;
                        }
                        String text = uiObject2.getText();
                        if (!org.apache.commons.lang.c.a(text)) {
                            String trim = text.trim();
                            if (!trim.contains("万")) {
                                int g = g(trim);
                                if (g >= HttpStatus.SC_INTERNAL_SERVER_ERROR) {
                                    if (a(uiObject2, i4, i, trim)) {
                                        c(uiObject2);
                                        i2 = 1;
                                    }
                                } else if (g > i6) {
                                    i5 = i3;
                                    i6 = g;
                                }
                            } else if (a(uiObject2, i4, i, trim)) {
                                c(uiObject2);
                                i2 = 1;
                            }
                        }
                    }
                }
                if (i2 != 1 && i6 > 50) {
                    UiObject uiObject3 = new UiObject(resourceId.instance(i5));
                    String text2 = uiObject3.getText();
                    if (!org.apache.commons.lang.c.a(text2) && a(uiObject3, i4, i, text2)) {
                        c(uiObject3);
                        return;
                    }
                    return;
                }
                return;
            }
            return;
        }
        System.out.println("has huobi " + p + " times !!! ");
    }

    protected void a(UiScrollable uiScrollable) throws UiObjectNotFoundException {
        System.out.println(" back to top....");
        UiObject findByResId = findByResId("com.taobao.taobao:id/detail_main_bottom_gotop", 1);
        if (findByResId == null || !findByResId.exists()) {
            findByResId = findByResId("com.taobao.taobao:id/btnGoTop", 1);
        }
        if (findByResId.exists()) {
            c.c(findByResId);
            c.d();
            findByResId = findByResId("com.taobao.taobao:id/detail_main_bottom_gotop", 1);
            if (findByResId == null || !findByResId.exists()) {
                findByResId = findByResId("com.taobao.taobao:id/btnGoTop", 1);
            }
            if (findByResId.exists()) {
                findByResId.click();
                return;
            }
            return;
        }
        simpleDragScroll(false, 6);
        c.c();
        simpleDragScroll(false, 6);
        c.c();
        simpleDragScroll(false, 6);
        c.c();
        simpleDragScroll(false, 6);
        c.c();
        if (uiScrollable == null) {
            uiScrollable = new UiScrollable(new UiSelector().scrollable(true));
        }
        int i = 0;
        while (i < 5) {
            System.out.println(" scroll back time:" + i);
            if (uiScrollable == null || !uiScrollable.exists()) {
                c.c();
                break;
            } else if (!uiScrollable.scrollBackward()) {
                c.c();
                break;
            } else {
                simpleDragScroll(false, 6);
                c.c();
                i++;
            }
        }
        simpleDragScroll(true);
        c.d();
        try {
            findByResId = findTextContain("我的足迹", 2);
            if (findByResId != null && findByResId.exists()) {
                this.device.click(100, this.device.getDisplayHeight() - 300);
            }
        } catch (Exception e) {
            simpleDragScroll(false, 6);
            c.c();
        }
    }

    public void a(UiScrollable uiScrollable, boolean z, boolean z2) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        int i;
        boolean z3;
        boolean z4;
        String b;
        int mainItemSeconds;
        int i2 = false;
        w.a(this.missionId, (int) WorkStatus.ItemViewMainPage);
        UiObject findTKLAccessBtn = findTKLAccessBtn();
        if (findTKLAccessBtn != null && findTKLAccessBtn.exists()) {
            findTKLAccessBtn.click();
            c.f();
        }
        checkLocationMock();
        checkStopTBTip();
        if (uiScrollable == null) {
            uiScrollable = findScroll();
        }
        String b2 = a.b("dumpsys activity | grep  -i  \"cmp=com.taobao.taobao/com.taobao.tao.detail.activity.DetailActivity\"");
        if (!org.apache.commons.lang.c.a(b2) && b2.contains("id=")) {
            if (b2.contains("id=" + this.searchParams.getId() + "&")) {
                i = 0;
                z3 = true;
            } else if (!b2.contains("id=" + this.searchParams.getId())) {
                z4 = true;
                z3 = false;
            }
            if (i == 1 || z3 || z || z2) {
                if (!z3) {
                    b = a.b("dumpsys activity | grep  -i  \"cmp=com.taobao.taobao/com.taobao.tao.shop.ShopHomePageActivity\"");
                    if (!org.apache.commons.lang.c.a(b) && b.contains("shop.m.taobao.com")) {
                        if (z) {
                            throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "这是店铺淘口令！");
                        } else if (z2) {
                            throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "这是店铺淘宝客！");
                        }
                    }
                }
                b = U();
                if (!z3) {
                    z3 = this.searchParams.getShopName().equals(b);
                }
                if (z3) {
                    mainItemSeconds = this.searchParams.getMainItemSeconds() / 2;
                    while (i2 <= mainItemSeconds) {
                        System.out.println("scroll : <" + i2 + "> with total" + mainItemSeconds);
                        simpleDragScroll(true);
                        if (uiScrollable == null && uiScrollable.exists()) {
                        }
                        if (i2 % 3 != 0) {
                            c.f();
                            i2++;
                        } else {
                            c.f();
                            i2++;
                        }
                    }
                    if (this.searchParams.isVisitiItemParams()) {
                        d(null);
                    }
                    if (this.searchParams.isVisitiShopRecommend()) {
                        e(null);
                    }
                    a(uiScrollable);
                } else if (z) {
                    findTKLAccessBtn = findTKLAccessBtn();
                    if (findTKLAccessBtn == null && findTKLAccessBtn.exists()) {
                        c.d();
                        c.d(findTKLAccessBtn);
                        c.f();
                        a(0, true, false);
                        return;
                    }
                    throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "网络异常，详情页进入失败！");
                } else if (!z2) {
                    throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "网络异常，详情页进入失败！");
                } else {
                    b++;
                    this.device.pressBack();
                    if (b >= 5) {
                        w();
                        a(0, false, false);
                    }
                    throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "同标题宝贝太多了！");
                }
            }
            b++;
            this.device.pressBack();
            if (b < 10) {
                w();
                a(0, false, false);
                return;
            }
            throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "同标题宝贝太多了！");
        }
        z4 = false;
        z3 = false;
        if (i == 1) {
        }
        if (z3) {
            b = a.b("dumpsys activity | grep  -i  \"cmp=com.taobao.taobao/com.taobao.tao.shop.ShopHomePageActivity\"");
            if (z) {
                throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "这是店铺淘口令！");
            } else if (z2) {
                throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "这是店铺淘宝客！");
            }
        }
        b = U();
        if (z3) {
            z3 = this.searchParams.getShopName().equals(b);
        }
        if (z3) {
            mainItemSeconds = this.searchParams.getMainItemSeconds() / 2;
            while (i2 <= mainItemSeconds) {
                System.out.println("scroll : <" + i2 + "> with total" + mainItemSeconds);
                simpleDragScroll(true);
                if (uiScrollable == null) {
                }
                if (i2 % 3 != 0) {
                    c.f();
                    i2++;
                } else {
                    c.f();
                    i2++;
                }
            }
            if (this.searchParams.isVisitiItemParams()) {
                d(null);
            }
            if (this.searchParams.isVisitiShopRecommend()) {
                e(null);
            }
            a(uiScrollable);
        } else if (z) {
            findTKLAccessBtn = findTKLAccessBtn();
            if (findTKLAccessBtn == null) {
            }
            throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "网络异常，详情页进入失败！");
        } else if (!z2) {
            b++;
            this.device.pressBack();
            if (b >= 5) {
                throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "同标题宝贝太多了！");
            }
            w();
            a(0, false, false);
        } else {
            throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "网络异常，详情页进入失败！");
        }
    }

    public void a(AccountBean accountBean) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        k kVar = new k(this.device, this.w.g(this.device), accountBean, this.searchParams.getTitle());
        kVar.a();
        kVar.doOpenZirco();
        kVar.b();
    }

    public void a(f fVar) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        List a = fVar.a();
        int size = a.size();
        for (int i = 0; i < size; i++) {
            this.searchParams = (SearchBean) a.get(i);
            b();
        }
    }

    public void a(String str) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (org.apache.commons.lang.c.a(str)) {
            throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "需要点赞的小号为：" + str);
        }
        UiObject n = n();
        if (n == null || !n.exists()) {
            c.f();
            n = n();
        }
        if (n == null || !n.exists()) {
            throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "不在评价页面上面哦");
        }
        int i;
        int i2 = n.getBounds().top;
        int i3 = n.getBounds().bottom;
        n = m();
        if (n != null && n.exists()) {
            c.c(n);
            c.f();
        }
        String replaceAll = str.replaceAll("，", ",");
        if (replaceAll.contains(",")) {
            String[] split = replaceAll.split(",");
            List arrayList = new ArrayList();
            for (String str2 : split) {
                if (!org.apache.commons.lang.c.a(str2)) {
                    arrayList.add(str2);
                }
            }
            System.out.println("do click " + arrayList.size() + " 个评价！");
            a(arrayList, i2, i3);
        } else {
            a(replaceAll, i2, i3);
        }
        UiScrollable findScroll = findScroll();
        if (findScroll == null || !findScroll.exists()) {
            c.e();
            return;
        }
        for (i = 0; i < 3; i++) {
            if (j.nextInt(HttpStatus.SC_MULTIPLE_CHOICES) > 100) {
                simpleDragScroll(true, 3);
            } else {
                simpleDragScroll(false, 3);
            }
            c.c();
        }
    }

    public boolean a(UiObject uiObject) throws UiObjectNotFoundException {
        if (uiObject == null || !uiObject.exists()) {
            return false;
        }
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/image_p4p");
        UiSelector resourceId2 = new UiSelector().resourceId("com.taobao.taobao:id/corner_icon");
        int i = 0;
        int i2 = 0;
        while (i < 10) {
            UiObject uiObject2 = new UiObject(resourceId.instance(i));
            if (uiObject2 == null || !uiObject2.exists()) {
                uiObject2 = new UiObject(resourceId2.instance(i));
            }
            i++;
            i2 = uiObject2.exists() ? i2 + 1 : i2;
        }
        b.b(" HOT ITEM COUNT :" + i2, new Object[0]);
        if (i2 <= 0) {
            return false;
        }
        for (i = 0; i < i2; i++) {
            uiObject2 = new UiObject(resourceId.instance(i));
            if (uiObject2 == null || !uiObject2.exists()) {
                uiObject2 = new UiObject(resourceId2.instance(i));
            }
            if (uiObject2 != null && uiObject2.exists()) {
                int i3 = uiObject2.getBounds().top;
                int i4 = uiObject.getBounds().top;
                int height = uiObject2.getBounds().height();
                if (i3 <= i4 && i4 - i3 <= height) {
                    return true;
                }
                b.b("hot image and title is not a couple !!! ", new Object[0]);
            }
        }
        return false;
    }

    public boolean a(UiObject uiObject, int i, int i2) throws UiObjectNotFoundException {
        if (uiObject == null || !uiObject.exists()) {
            return false;
        }
        return uiObject.getBounds().top >= i && uiObject.getBounds().bottom <= i2;
    }

    public boolean a(UiObject uiObject, int i, int i2, String str) throws UiObjectNotFoundException {
        return a(uiObject, i, i2) && e(str);
    }

    public boolean a(String str, String str2) throws UiObjectNotFoundException {
        if (org.apache.commons.lang.c.a(str)) {
            return false;
        }
        if (str.equals(str2)) {
            return true;
        }
        if (str.contains(str2)) {
            return true;
        }
        String a = c.a(str, str2);
        b.b(" source[%s], target [%s]", str, str2);
        int c = org.apache.commons.lang.c.c(a);
        if (org.apache.commons.lang.c.a(a) || c != str2.length()) {
            return false;
        }
        b.b(" the same text :[" + a + "] length :" + c, new Object[0]);
        return true;
    }

    public UiObject b(String str) throws UiObjectNotFoundException {
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/detail_comment_nick");
        String str2 = str;
        for (int i = 0; i < 10; i++) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            if (!uiObject.exists()) {
                break;
            }
            String text = uiObject.getText();
            if (!org.apache.commons.lang.c.a(text)) {
                Object trim = text.trim();
                if (trim.length() > 2) {
                    trim = trim.substring(0, 1) + trim.substring(trim.length() - 1);
                }
                str2 = str2.trim();
                if (str2.length() > 2) {
                    str2 = str2.substring(0, 1) + str2.substring(str2.length() - 1);
                }
                if (str2.equals(trim)) {
                    return uiObject;
                }
            }
        }
        return null;
    }

    public void b() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        doOpenTaobao();
        o();
        p();
        d();
    }

    public void b(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        r(i);
        n(i);
        q(i);
        o(i);
    }

    public void b(UiScrollable uiScrollable) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        checkLocationMock();
        checkStopTBTip();
        if (uiScrollable == null) {
            findScroll();
        }
        if (org.apache.commons.lang.c.a(a.b("dumpsys activity | grep  -i  \"cmp=com.taobao.taobao/com.taobao.tao.detail.activity.DetailActivity\""))) {
            UiObject findWeitaoView = findWeitaoView();
            if (findWeitaoView != null && findWeitaoView.exists()) {
                weitaoPageItem();
            }
            c.e();
            if (org.apache.commons.lang.c.a(a.b("dumpsys activity | grep  -i  \"cmp=com.taobao.taobao/com.taobao.tao.detail.activity.DetailActivity\""))) {
                throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "进入宝贝详情页失败！");
            }
        }
        int mainItemSeconds = this.searchParams.getMainItemSeconds();
        for (int i = 0; i < mainItemSeconds; i++) {
            System.out.println("scroll : <" + i + "> with total" + mainItemSeconds);
            simpleDragScroll(true);
            if (i % 3 == 0) {
                checkNewVersionTip();
            }
            c.c();
        }
        c.c();
        if (this.searchParams.isVisitiItemParams()) {
            d(null);
        }
        if (this.searchParams.isVisitiShopRecommend()) {
            e(null);
        }
    }

    public boolean b(UiObject uiObject) throws UiObjectNotFoundException {
        if (uiObject == null || !uiObject.exists()) {
            return false;
        }
        String text = uiObject.getText();
        if (org.apache.commons.lang.c.a(text) || !org.apache.commons.lang.c.d(text)) {
            return false;
        }
        int parseInt = Integer.parseInt(text.trim());
        return parseInt >= this.searchParams.getHuobiMinPrice() && parseInt <= this.searchParams.getHuobiMaxPrice();
    }

    public UiObject c(String str) throws UiObjectNotFoundException {
        int i;
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/title");
        int i2 = 0;
        for (i = 0; i < 10; i++) {
            if (new UiObject(resourceId.instance(i)).exists()) {
                i2++;
            }
        }
        b.b(" title count :" + i2, new Object[0]);
        for (i = 0; i < 10; i++) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            boolean exists = uiObject.exists();
            b.b(" curr title instance [" + i + "] with title exists :" + exists, new Object[0]);
            if (exists) {
                String text = uiObject.getText();
                if (org.apache.commons.lang.c.a(text)) {
                    b.b(" curr title not text....", new Object[0]);
                } else {
                    b.b(" last title is:" + g + ",last index:" + h + ",i:" + i, new Object[0]);
                    if (h < i) {
                        text = text.trim();
                        b.b(" source[%s], target [%s]", str, text);
                        if (b(str, text)) {
                            h = i;
                            return uiObject;
                        } else if (text.contains("..") || text.contains("··")) {
                            CharSequence trim = text.replaceAll(".", "").replaceAll("·", "").trim();
                            if (trim.length() >= 10 && str.contains(trim)) {
                                h = i;
                                return uiObject;
                            }
                        }
                    } else {
                        continue;
                    }
                }
            }
        }
        return null;
    }

    public void c() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        checkLocationMock();
        checkStopTBTip();
        UiScrollable findScroll = findScroll();
        T();
        int mainItemSeconds = this.searchParams.getMainItemSeconds();
        for (int i = 0; i <= mainItemSeconds; i++) {
            System.out.println("scroll : <" + i + "> with total" + mainItemSeconds);
            simpleDragScroll(true);
            c.d();
        }
        if (this.searchParams.isVisitiItemParams()) {
            d(null);
        }
        if (this.searchParams.isVisitiShopRecommend()) {
            e(null);
        }
        a(findScroll);
    }

    public void c(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        b.b(" recover from status :[%d]", Integer.valueOf(i));
        g(i);
        boolean isZhanXian = this.searchParams.isZhanXian();
        String title = this.searchParams.getTitle();
        if (!isZhanXian || org.apache.commons.lang.c.a(title)) {
            isZhanXian = this.searchParams.isTaokeItem();
            boolean isTKLItem = this.searchParams.isTKLItem();
            boolean isWeitao = this.searchParams.isWeitao();
            String tklItemUrl = this.searchParams.getTklItemUrl();
            if (isTKLItem && !org.apache.commons.lang.c.a(tklItemUrl)) {
                backToHome(this.device);
                a.e(tklItemUrl);
                doOpenTBAndDirectToItem();
                a(i, true, false);
            } else if (isWeitao && !org.apache.commons.lang.c.a(tklItemUrl)) {
                backToHome(this.device);
                a.e(tklItemUrl);
                doOpenTBAndDirectToItem();
                weitaoPageItem();
                b(null);
                w.a(this.missionId, (int) WorkStatus.NetflowOver);
                return;
            } else if (isZhanXian) {
                L();
                a(i, false, true);
            } else {
                d(i);
                n(i);
                q(i);
                m(i);
                a(i, false, false);
            }
            isZhanXian = this.searchParams.isNeedStored();
            System.out.println("this item is need to be stored:" + isZhanXian);
            if (isZhanXian) {
                l(i);
            }
            p(i);
            j(i);
            e(i);
            i(i);
            k(i);
            if (y()) {
                f(i);
            }
            this.device.pressBack();
            c.b();
            this.device.pressBack();
            w.a(this.missionId, (int) WorkStatus.NetflowOver);
            return;
        }
        b.b(" mission type is zhanxian mission", new Object[0]);
        h(i);
    }

    public void c(UiObject uiObject) throws UiObjectNotFoundException {
        int i = 0;
        if (uiObject != null && uiObject.exists()) {
            int huobiNum = this.searchParams.getHuobiNum();
            StringBuilder append = new StringBuilder().append("huobi: ");
            int i2 = p + 1;
            p = i2;
            b.b(append.append(i2).append(" / maxNum:").append(huobiNum).toString(), new Object[0]);
            c.c(uiObject);
            c.e();
            while (i < 3) {
                simpleDragScroll(true, 4);
                c.c();
                i++;
            }
            if (!z()) {
                this.device.pressBack();
            }
        }
    }

    public void c(UiScrollable uiScrollable) throws UiObjectNotFoundException {
        w.a(this.missionId, (int) WorkStatus.ItemViewShopName);
        checkNewVersionTip();
        checkStopTBTip();
        UiObject findText = findText("店铺", 2);
        if (findText != null && findText.exists()) {
            c.d(findText);
            k(null);
            this.device.pressBack();
        }
    }

    protected void checkBiaoqianTip() throws UiObjectNotFoundException {
        UiObject findTextContain = findTextContain("标签", 1);
        System.out.println(" check  has more tip....." + findTextContain);
        if (findTextContain.exists()) {
            findTextContain = C();
            if (findTextContain.exists()) {
                c.c(findTextContain);
                c.e();
            }
        }
    }

    protected void checkSameTip() throws UiObjectNotFoundException {
        UiObject findTextContain = findTextContain("找相似", 1);
        System.out.println(" check  has more tip....." + findTextContain);
        if (findTextContain.exists()) {
            findTextContain = C();
            if (findTextContain.exists()) {
                c.c(findTextContain);
                c.e();
            }
        }
    }

    public UiObject d(String str) throws UiObjectNotFoundException {
        int i;
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/title");
        int i2 = 0;
        for (i = 0; i < 10; i++) {
            if (new UiObject(resourceId.instance(i)).exists()) {
                i2++;
            }
        }
        b.b(" title count :" + i2, new Object[0]);
        i = 0;
        while (i < 10) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            boolean exists = uiObject.exists();
            b.b(" curr title instance [" + i + "] with title exists :" + exists, new Object[0]);
            if (exists && h < i) {
                String text = uiObject.getText();
                if (org.apache.commons.lang.c.a(text)) {
                    b.b(" curr title not text....", new Object[0]);
                } else {
                    text = text.trim();
                    b.b(" source[%s], target [%s]", str, text);
                    if (b(str, text)) {
                        continue;
                    } else {
                        if (text.contains("..") || text.contains("··")) {
                            CharSequence trim = text.replaceAll(".", "").replaceAll("·", "").trim();
                            if (trim.length() >= 8 && str.contains(trim)) {
                            }
                        }
                        h = i;
                        return uiObject;
                    }
                }
            }
            i++;
        }
        return null;
    }

    public void d() throws com.sutuijingling.result.c, UiObjectNotFoundException {
        w.a(this.missionId, (int) WorkStatus.ItemViewEnter);
        System.out.println(" start to visit item in depth");
        c.d();
        UiScrollable uiScrollable = new UiScrollable(new UiSelector().scrollable(true));
        if (uiScrollable.exists()) {
            a(uiScrollable, false, false);
            f(uiScrollable);
            g(uiScrollable);
            j(uiScrollable);
            b.b(" visit item with depth over..", new Object[0]);
            return;
        }
        throw new com.sutuijingling.result.c(HttpStatus.SC_NOT_FOUND, "都到了宝贝详情页居然没什么东西号逛啊...");
    }

    public void d(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        checkAppIsCode();
        if (!isPackageTaobao()) {
            doOpenSearchPage();
        }
        if (i <= WorkStatus.EnterSearchPage) {
            b.b("enter search page current status :" + i, new Object[0]);
            o();
        }
    }

    public void d(UiScrollable uiScrollable) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        UiObject findText = findText("产品参数", 2);
        if (findText.exists()) {
            c.d(findText);
            if (uiScrollable == null) {
                uiScrollable = findScroll();
            }
            if (uiScrollable == null || !uiScrollable.exists()) {
                c.e();
                return;
            }
            for (int i = 0; i < 3; i++) {
                simpleDragScroll(true);
                c.c();
            }
        }
    }

    public boolean doViewItem() throws UiObjectNotFoundException {
        if (!R()) {
            c.e();
        }
        if (!R()) {
            return false;
        }
        if (this.searchParams.isNeedStored()) {
            boolean S = S();
            System.out.println("store shop result: " + S);
            a(S);
        }
        try {
            k(null);
            UiObject findText = findText("宝贝分类", 2);
            if (findText != null && findText.exists()) {
                c.c(findText);
                k(null);
                this.device.pressBack();
                c.c();
            }
            findText = findText("店铺简介", 2);
            if (findText != null && findText.exists()) {
                c.c(findText);
                k(null);
                this.device.pressBack();
                c.c();
            }
            return true;
        } catch (UiObjectNotFoundException e) {
            e.printStackTrace();
            return false;
        }
    }

    public UiObject e() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/detail_main_comment_count", 1);
        UiObject findText = findText("查看更多评价", 1);
        if (findText == null || !findText.exists()) {
            findText = findByResId;
        }
        findByResId = findText("查看全部评价", 1);
        return (findByResId == null || !findByResId.exists()) ? findText : findByResId;
    }

    public void e(int i) throws UiObjectNotFoundException {
        if (i > WorkStatus.ItemViewShopName) {
            b.b(" no need to view by shopname  :" + i, new Object[0]);
            return;
        }
        if (i == WorkStatus.ItemViewShopName) {
            if (isShopHomePage()) {
                this.device.pressBack();
            } else if (isItemDetail()) {
                a(findScroll());
            }
        }
        if (this.searchParams.isTaokeItem()) {
            if (isSearchPage()) {
                this.device.pressBack();
                c.d();
            }
            if (isHomePage()) {
                this.device.pressBack();
                c.b();
                this.device.pressBack();
                c.c();
            }
        }
        if (this.searchParams.isVisitMainShop()) {
            f(null);
        }
    }

    public void e(UiScrollable uiScrollable) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        UiObject findText = findText("店铺推荐", 2);
        if (findText.exists()) {
            c.d(findText);
            if (uiScrollable == null) {
                uiScrollable = findScroll();
            }
            if (uiScrollable == null || !uiScrollable.exists()) {
                c.e();
                return;
            }
            for (int i = 0; i < 3; i++) {
                simpleDragScroll(true);
                c.c();
            }
        }
    }

    public boolean e(String str) {
        if (org.apache.commons.lang.c.a(str)) {
            return true;
        }
        if (q.contains(str)) {
            return false;
        }
        q.add(str);
        return true;
    }

    public void f() throws UiObjectNotFoundException {
        UiObject g = g();
        if (g == null || !g.exists()) {
            b.b(" there is no store btn ...", new Object[0]);
            a(false);
            return;
        }
        b.b("start to store zhibo !!!!!! ", new Object[0]);
        c.c(g);
        c.f();
        g = g();
        if (g == null || !g.exists()) {
            b.b(" store zhibo successful ...", new Object[0]);
            a(true);
            return;
        }
        g.click();
        c.f();
        g = g();
        if (g == null || !g.exists()) {
            b.b(" store zhibo successful ...", new Object[0]);
            a(true);
            return;
        }
        b.b(" store zhibo failed ...", new Object[0]);
        a(false);
    }

    public void f(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        checkAppIsCode();
        if (isItemDetailPage()) {
            this.device.pressBack();
        }
        if (N()) {
            simpleDragScroll(true, 4);
            int i2 = 10;
            int displayHeight = this.device.getDisplayHeight();
            while (true) {
                int i3 = i2 - 1;
                if (i2 <= 0) {
                    break;
                }
                a(displayHeight);
                if (!y() || !new UiScrollable(new UiSelector().scrollable(true)).exists()) {
                    break;
                }
                simpleDragScroll(true, 4);
                i2 = i3;
            }
            System.out.println(" finish huobi !!! ");
        }
    }

    public void f(UiScrollable uiScrollable) throws UiObjectNotFoundException {
        w.a(this.missionId, (int) WorkStatus.ItemViewShopName);
        checkNewVersionTip();
        checkStopTBTip();
        new UiSelector().className(TextView.class);
        UiObject ak = ak();
        if (ak == null || !ak.exists()) {
            b.b(" can not find shopname", new Object[0]);
            return;
        }
        UiObject ak2;
        if (ak != null && ak.exists()) {
            int i = ak.getVisibleBounds().bottom;
            int displayHeight = this.device.getDisplayHeight() - 140;
            UiObject V = V();
            if (V != null && V.exists()) {
                displayHeight = V.getBounds().top;
            }
            b.b(" max Bottom [%d], itemcate bottom [%d]", Integer.valueOf(displayHeight), Integer.valueOf(i));
            if (i >= displayHeight) {
                int displayWidth = this.device.getDisplayWidth() / 2;
                displayHeight = this.device.getDisplayHeight() / 2;
                b.b(" swipe [%d],[%d],[%d],[%d],", Integer.valueOf(displayWidth), Integer.valueOf(displayHeight + 100), Integer.valueOf(displayWidth), Integer.valueOf(displayHeight - 100));
                c.a(this.device, displayWidth, i, displayWidth, r4, 20);
                c.e();
                ak2 = ak();
                d(ak2);
            }
        }
        ak2 = ak;
        d(ak2);
    }

    public void f(String str) throws UiObjectNotFoundException {
        if (r <= 0) {
            UiObject d;
            int i;
            h = -1;
            UiObject uiObject = null;
            int i2 = 0;
            while (true) {
                int i3 = i2 + 1;
                if (i2 >= 5) {
                    break;
                }
                d = d(str);
                if (d != null && d.exists()) {
                    uiObject = findByResId("com.taobao.taobao:id/search_header_container", 1);
                    UiObject findByResId = (uiObject == null || !uiObject.exists()) ? findByResId("com.taobao.taobao:id/float_header", 1) : uiObject;
                    i = 180;
                    if (findByResId != null && findByResId.exists()) {
                        i = findByResId.getBounds().bottom;
                    }
                    if (d.getBounds().top > i) {
                        break;
                    }
                    uiObject = d;
                    i2 = i3;
                } else {
                    simpleDragScroll(true, 4);
                    c.c();
                    uiObject = d;
                    i2 = i3;
                }
            }
            uiObject = d;
            if (uiObject != null && uiObject.exists()) {
                c.c(uiObject);
                c.e();
                r++;
                for (i = 0; i < 3; i++) {
                    simpleDragScroll(true, 4);
                    c.c();
                }
                if (!z()) {
                    this.device.pressBack();
                }
            }
        }
    }

    public int g(String str) {
        if (org.apache.commons.lang.c.a(str)) {
            return 0;
        }
        String replaceAll = str.substring(0, str.length() - 3).replaceAll("人收货|人付款", "");
        int i = 1;
        if (replaceAll.endsWith("万")) {
            i = WorkStatus.heihei;
            replaceAll = replaceAll.substring(0, replaceAll.length() - 1);
        }
        try {
            i = (int) (Double.valueOf(replaceAll).doubleValue() * ((double) i));
        } catch (Exception e) {
            i = 0;
        }
        return i;
    }

    public UiObject g() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/taolive_follow_status", 1);
        return (findByResId == null || findByResId.exists()) ? findByResId : findByResId;
    }

    public void g(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        if (!isPackageTaobao()) {
            doOpenSearchPage();
        }
        if (checkTBLogin(i == 26491934)) {
            if (i == 26491934) {
                writeIfCanBackup(true);
            }
            b.a(9004);
            a.g();
            c.d();
            a.f();
            return;
        }
        b.b(" taobao is not login !!!", new Object[0]);
        b.a(9003);
        throw new com.sutuijingling.result.c(9003, "未检测到淘宝登录");
    }

    public void g(UiScrollable uiScrollable) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        System.out.println("start to find comment");
        w.a(this.missionId, (int) WorkStatus.ItemViewCommentPage);
        checkNewVersionTip();
        checkStopTBTip();
        if (uiScrollable == null) {
            findScroll();
        }
        b.b(" try to scroll find the next child...", new Object[0]);
        if (findByResId("com.taobao.taobao:id/detail_main_sku_content", 1).exists()) {
            this.searchParams.setMultipleSku(true);
        }
        UiObject e = e();
        boolean isDianzan = this.searchParams.isDianzan();
        if (e == null || !e.exists()) {
            b.b(" no comment 11", new Object[0]);
            if (isDianzan) {
                UiObject ak = ak();
                if (ak != null && ak.exists()) {
                    simpleDragScroll(false);
                    c.d();
                    e = e();
                }
            }
        } else if (e.getBounds().top < 130) {
            simpleDragScroll(false);
            c.d();
            e = e();
        }
        if (e == null || !e.exists()) {
            b.b(" no comment enter found, next...", new Object[0]);
            if (isDianzan) {
                throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "没有进入评价的按钮");
            }
            return;
        }
        e(e);
    }

    public void h() throws UiObjectNotFoundException {
        w.a(this.missionId, (int) WorkStatus.ItemViewAllItems);
        UiObject findByResId = findByResId("com.taobao.taobao:id/detail_main_seller_dsr_info2", 2);
        if (findByResId == null || !findByResId.exists()) {
            b.b("no seller dsr.. go back", new Object[0]);
            return;
        }
        Rect bounds = findByResId.getBounds();
        int i = (bounds.right + (bounds.left * 3)) / 4;
        int i2 = (bounds.top + bounds.bottom) / 2;
        findByResId = findByResId.getChild(new UiSelector().instance(0));
        b.b(" get the next dsr child", new Object[0]);
        debugUiObject(findByResId);
        if (findByResId.exists()) {
            c.d(findByResId);
            c.c();
            this.device.pressBack();
            if (isShopAllItemPage()) {
                this.device.pressBack();
            }
            if (!isItemDetail()) {
                this.device.pressBack();
            }
        }
    }

    public void h(int i) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        d(i);
        n(i);
        q(i);
        v();
        this.device.pressBack();
        c.b();
        this.device.pressBack();
        w.a(this.missionId, (int) WorkStatus.NetflowOver);
    }

    public void h(UiScrollable uiScrollable) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        System.out.println("start to find store btn");
        w.a(this.missionId, (int) WorkStatus.ItemDoStoreUp);
        checkNewVersionTip();
        checkStopTBTip();
        if (findText("已收藏", 1).exists()) {
            b.b(" has been stored ...", new Object[0]);
            a(false);
            return;
        }
        UiObject findText = findText("收藏", 1);
        if (findText == null || !findText.exists()) {
            b.b(" no store btn...", new Object[0]);
            a(false);
            return;
        }
        b.b("start to store up item !!!!!! ", new Object[0]);
        c.a(findText, 1000);
        findText = findText("已收藏", 1);
        if (findText == null || !findText.exists()) {
            c.e();
            findText = findText("已收藏", 1);
        }
        if (findText == null || !findText.exists()) {
            throw new com.sutuijingling.result.c(HttpStatus.SC_SERVICE_UNAVAILABLE, "收藏失败！");
        }
        b.b(" store up item success !!!!!! ", new Object[0]);
        a(true);
    }

    public void i(UiScrollable uiScrollable) throws UiObjectNotFoundException {
        UiObject uiObject = new UiObject(new UiSelector().className(EditText.class));
        c.c(uiObject);
        c.c();
        ensureInput(uiObject, "66");
    }

    public boolean i() {
        String b = a.b("dumpsys activity | grep  -i  \"cmp=com.taobao.taobao/com.taobao.tao.detail.activity.DetailActivity\"");
        if (!org.apache.commons.lang.c.a(b) && b.contains("id=")) {
            return true;
        }
        UiObject findText = findText("加入购物车", 1);
        if (findText != null && findText.exists()) {
            return true;
        }
        findText = findText("立即购买", 1);
        return findText != null && findText.exists();
    }

    public boolean isItemDetailPage() {
        return findText("加入购物车", 1).exists() || findText("立即购买", 1).exists();
    }

    public void j() throws UiObjectNotFoundException {
        checkLocationMock();
        checkStopTBTip();
        if (!i()) {
            c.e();
            if (!i()) {
                return;
            }
        }
        for (int i = 0; i < 4; i++) {
            System.out.println("scroll : <" + i + "> with total" + 4);
            simpleDragScroll(true);
            if (i % 3 == 0) {
                checkNewVersionTip();
            }
            c.c();
        }
        if (i()) {
            this.device.pressBack();
            c.d();
        }
    }

    public void j(UiScrollable uiScrollable) throws UiObjectNotFoundException, com.sutuijingling.result.c {
        UiObject aj;
        int i;
        w.a(this.missionId, (int) WorkStatus.ItemViewItemCate);
        checkNewVersionTip();
        checkStopTBTip();
        if (uiScrollable == null) {
            uiScrollable = findScroll();
        }
        int i2 = 0;
        while (true) {
            int i3 = i2 + 1;
            if (i2 >= 2 || isItemDetail()) {
                b.b(" check for the item cate skip the buyer button", new Object[0]);
            } else {
                c.c();
                i2 = i3;
            }
        }
        b.b(" check for the item cate skip the buyer button", new Object[0]);
        if (isItemDetail()) {
            aj = aj();
            if (aj != null && aj.exists()) {
                i3 = aj.getVisibleBounds().bottom;
                i2 = this.device.getDisplayHeight() - 140;
                UiObject V = V();
                if (V != null && V.exists()) {
                    i2 = V.getBounds().top;
                }
                b.b(" max Bottom [%d], itemcate bottom [%d]", Integer.valueOf(i2), Integer.valueOf(i3));
                if (i3 >= i2) {
                    i3 = this.device.getDisplayWidth() / 2;
                    i2 = this.device.getDisplayHeight() / 2;
                    b.b(" swipe [%d],[%d],[%d],[%d],", Integer.valueOf(i3), Integer.valueOf(i2 + 80), Integer.valueOf(i3), Integer.valueOf(i2 - 80));
                    c.a(this.device, i3, i, i3, r4, 20);
                }
            }
        }
        if (!isItemCatePage()) {
            UiObject aj2 = aj();
            if (aj2 != null && aj2.exists()) {
                i = aj2.getVisibleBounds().bottom;
                i2 = this.device.getDisplayHeight() - 140;
                UiObject V2 = V();
                if (V2 != null && V2.exists()) {
                    i2 = V2.getBounds().top;
                }
                b.b(" max Bottom [%d], itemcate bottom [%d]", Integer.valueOf(i2), Integer.valueOf(i));
                if (i >= i2) {
                    i3 = this.device.getDisplayWidth() / 2;
                    i2 = this.device.getDisplayHeight() / 2;
                    b.b(" swipe [%d],[%d],[%d],[%d],", Integer.valueOf(i3), Integer.valueOf(i2 + 80), Integer.valueOf(i3), Integer.valueOf(i2 - 80));
                    c.a(this.device, i3, i, i3, r4, 20);
                    c.e();
                    aj = aj();
                    if (aj != null && aj.exists()) {
                        c.d(aj);
                        c.d();
                    } else {
                        return;
                    }
                }
            }
            aj = aj2;
            if (aj != null) {
                return;
            }
            return;
        }
        if (!isItemCatePage()) {
            b.b(" first time not the item category page", new Object[0]);
            this.device.pressBack();
            c.d();
        }
        if (isItemCatePage()) {
            k(uiScrollable);
        }
        if (!isItemDetail()) {
            this.device.pressBack();
        }
    }

    public UiObject k() throws UiObjectNotFoundException {
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/title");
        int i = 0;
        while (i < 5) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            if (uiObject.exists()) {
                String text = uiObject.getText();
                if (!org.apache.commons.lang.c.a(text) && d < i) {
                    if (text.contains("..")) {
                        text = text.replaceAll(".", "");
                    }
                    text = text.trim();
                    if (e == null) {
                        e = new ArrayList();
                    }
                    if (!e.contains(text)) {
                        e.add(text);
                        d = i;
                        return uiObject;
                    }
                }
            }
            i++;
        }
        return null;
    }

    public UiObject l() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/rate_detail_op_like", 1);
        if (!findByResId.exists()) {
            findByResId = findText("赞TA", 1);
            if (findByResId.exists()) {
            }
        }
        return findByResId;
    }

    public UiObject m() throws UiObjectNotFoundException {
        UiObject findText = findText("有图", 1);
        if (!findText.exists()) {
            findText = findTextContain("有图(", 1);
            if (findText.exists()) {
            }
        }
        return findText;
    }

    public UiObject n() throws UiObjectNotFoundException {
        UiObject findByResId = findByResId("com.taobao.taobao:id/comment_flipper", 1);
        return findByResId.exists() ? findByResId : findByResId;
    }

    public void o() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        checkNewVersionTip();
        checkLocationMock();
        checkStopTBTip();
        checkAppIsCode();
        if (isSearchPage()) {
            b.b(" it's already the serach result page..", new Object[0]);
            return;
        }
        UiObject findSearchPageBtn = findSearchPageBtn();
        if (findSearchPageBtn == null || !findSearchPageBtn.exists()) {
            int i = 0;
            while (isItemDetail()) {
                int i2 = i + 1;
                if (i >= 2) {
                    break;
                }
                b.b(" it's the item detail page... at count :" + i2, new Object[0]);
                this.device.pressBack();
                c.c();
                this.device.pressBack();
                c.c();
                i = i2;
            }
            if (isSearchResultPage()) {
                b.b(" it's the item search result page...", new Object[0]);
                this.device.pressBack();
                c.d();
            } else if (isHomeTaobaoPage()) {
                b.b(" why it's the taobao home page....", new Object[0]);
            }
            if (isSearchPage()) {
                b.b(" it's already the serach result page.. round 2", new Object[0]);
                return;
            }
            findSearchPageBtn = findSearchPageBtn();
            if (findSearchPageBtn == null && isPackageTaobao()) {
                b.b(" no search btn and in still taobao, it might be covered", new Object[0]);
                this.device.pressBack();
                c.d();
                findSearchPageBtn = findSearchPageBtn();
            }
            if (findSearchPageBtn == null) {
                doOpenSearchPage();
                return;
            }
            ensureExist(findSearchPageBtn, "Not in search page???????????");
            c.d(findSearchPageBtn);
            return;
        }
        c.d(findSearchPageBtn);
    }

    public void p() throws com.sutuijingling.result.c, UiObjectNotFoundException {
        checkNetflowTip();
        ab();
        c.c();
        q();
        System.out.println(" start find price interval..");
        c.c();
        w();
    }

    public void q() throws UiObjectNotFoundException, com.sutuijingling.result.c {
        checkLocationMock();
        checkAppIsCode();
        if (af()) {
            D();
            if (this.searchParams.isSalenumfirst()) {
                r();
            }
        }
    }

    public void r() throws UiObjectNotFoundException {
        UiObject findText = findText("销量优先", 2);
        if (findText == null || !findText.exists()) {
            c.e();
        }
        findText = findText("销量优先", 2);
        if (findText != null && findText.exists()) {
            c.c(findText);
            c.e();
        }
    }

    public UiObject s() throws UiObjectNotFoundException {
        String title = this.searchParams.getTitle();
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/title");
        int i = 0;
        while (i < 10) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            if (uiObject.exists()) {
                String text = uiObject.getText();
                if (!org.apache.commons.lang.c.a(text) && h < i) {
                    if (text.contains("..")) {
                        text = text.replaceAll(".", "");
                    }
                    if (text.contains("··")) {
                        text = text.replaceAll("·", "");
                    }
                    text = text.trim();
                    String a = c.a(title, text);
                    int c = org.apache.commons.lang.c.c(a);
                    if (!(org.apache.commons.lang.c.a(a) || c != text.length() || a(uiObject))) {
                        h = i;
                        return uiObject;
                    }
                }
            }
            i++;
        }
        return null;
    }

    public UiObject t() throws UiObjectNotFoundException {
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/title");
        int i = 0;
        while (i < 10) {
            UiObject uiObject = new UiObject(resourceId.instance(i));
            if (uiObject.exists() && !org.apache.commons.lang.c.a(uiObject.getText()) && h < i && !a(uiObject)) {
                h = i;
                return uiObject;
            }
            i++;
        }
        return null;
    }

    public UiObject u() throws UiObjectNotFoundException {
        String title1 = this.searchParams.getTitle1();
        String title2 = this.searchParams.getTitle2();
        UiSelector resourceId = new UiSelector().resourceId("com.taobao.taobao:id/auction_layout");
        UiSelector resourceId2 = new UiSelector().resourceId("com.taobao.taobao:id/image_p4p");
        UiSelector resourceId3 = new UiSelector().resourceId("com.taobao.taobao:id/corner_icon");
        UiSelector resourceId4 = new UiSelector().resourceId("com.taobao.taobao:id/title");
        UiSelector className = new UiSelector().className(RelativeLayout.class);
        int i = 0;
        int i2 = 0;
        while (i2 < 10) {
            UiObject uiObject = new UiObject(resourceId2.instance(i2));
            if (uiObject == null || !uiObject.exists()) {
                uiObject = new UiObject(resourceId3.instance(i2));
            }
            i2++;
            i = uiObject.exists() ? i + 1 : i;
        }
        if (i <= 0) {
            return null;
        }
        i2 = 0;
        while (i2 < 10) {
            UiObject uiObject2 = new UiObject(resourceId.instance(i2));
            if (uiObject2 == null || !uiObject2.exists()) {
                break;
            }
            uiObject = uiObject2.getChild(className.instance(0)).getChild(resourceId2);
            if (uiObject == null || !uiObject.exists()) {
                uiObject = uiObject2.getChild(className.instance(0)).getChild(resourceId3);
            }
            if (uiObject != null && uiObject.exists()) {
                UiObject child = uiObject2.getChild(className.instance(1)).getChild(resourceId4);
                if (child.exists()) {
                    int i3 = uiObject.getBounds().top;
                    int i4 = child.getBounds().top;
                    int height = uiObject2.getBounds().height();
                    if (i3 > i4 || i4 - i3 > height) {
                        b.b("hot image and title is not a couple !!! ", new Object[0]);
                    } else {
                        String text = child.getText();
                        if (!org.apache.commons.lang.c.a(text) && h < i2) {
                            if (text.contains("..")) {
                                text = text.replaceAll(".", "");
                            }
                            text = text.trim();
                            if (a(title1, text)) {
                                h = i2;
                                return child;
                            } else if (!(org.apache.commons.lang.c.a(title2) || title2.equals(title1) || !a(title2, text))) {
                                h = i2;
                                return child;
                            }
                        }
                    }
                }
                continue;
            }
            i2++;
        }
        return null;
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void v() throws com.android.uiautomator.core.UiObjectNotFoundException, com.sutuijingling.result.c {
        /*
        r10 = this;
        r9 = 2;
        r2 = 0;
        r8 = 4;
        r7 = 1;
        r0 = r10.searchParams;
        r5 = r0.getTitle();
        r0 = java.lang.System.out;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r3 = " try match title:";
        r1 = r1.append(r3);
        r1 = r1.append(r5);
        r1 = r1.toString();
        r0.println(r1);
        r0 = r10.hasSearchResultGidMid();
        if (r0 == 0) goto L_0x009e;
    L_0x0028:
        r10.I();
        com.sutuijingling.utils.c.e();
    L_0x002e:
        r0 = r2;
    L_0x002f:
        r1 = r0 + 1;
        if (r0 >= r8) goto L_0x003f;
    L_0x0033:
        r0 = "com.taobao.taobao:layout/tbsearch_item_list_improve";
        r0 = r10.findByResId(r0, r7);
        r0 = r0.exists();
        if (r0 == 0) goto L_0x00ed;
    L_0x003f:
        com.sutuijingling.utils.c.c();
        r1 = 0;
        r0 = r10.ad();
        r3 = r0;
        r0 = r2;
    L_0x0049:
        r4 = r3 + -1;
        if (r3 <= 0) goto L_0x0187;
    L_0x004d:
        com.sutuijingling.utils.c.b();
        r1 = " try match title %s at round %d";
        r3 = new java.lang.Object[r9];
        r3[r2] = r5;
        r6 = java.lang.Integer.valueOf(r4);
        r3[r7] = r6;
        com.sutuijingling.utils.b.b(r1, r3);
        r1 = r10.c(r5);
        if (r1 == 0) goto L_0x0121;
    L_0x0065:
        r3 = r1.exists();
        if (r3 == 0) goto L_0x0121;
    L_0x006b:
        r10.simpleDragScroll(r7, r8);
        com.sutuijingling.utils.c.c();
        r10.simpleDragScroll(r7, r8);
        com.sutuijingling.utils.c.c();
        r0 = r1;
    L_0x0078:
        r10.debugUiObject(r0);
        if (r0 == 0) goto L_0x0083;
    L_0x007d:
        r0 = r0.exists();
        if (r0 != 0) goto L_0x0175;
    L_0x0083:
        r0 = new com.sutuijingling.result.c;
        r1 = NOT_EXIST;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "title 找不到宝贝id....";
        r2 = r2.append(r3);
        r2 = r2.append(r5);
        r2 = r2.toString();
        r0.<init>(r1, r2);
        throw r0;
    L_0x009e:
        r0 = "com.taobao.taobao:id/auction";
        r0 = r10.findByResId(r0, r7);
        r1 = r0.exists();
        if (r1 == 0) goto L_0x002e;
    L_0x00aa:
        r0 = r0.getBounds();
        r1 = r0.right;
        r3 = r0.left;
        r1 = r1 - r3;
        r1 = java.lang.Math.abs(r1);
        r3 = r0.bottom;
        r0 = r0.top;
        r0 = r3 - r0;
        r0 = java.lang.Math.abs(r0);
        r3 = java.lang.System.out;
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r6 = "item layout width:";
        r4 = r4.append(r6);
        r4 = r4.append(r1);
        r6 = ", height:";
        r4 = r4.append(r6);
        r4 = r4.append(r0);
        r4 = r4.toString();
        r3.println(r4);
        if (r1 >= r0) goto L_0x002e;
    L_0x00e5:
        r10.I();
        com.sutuijingling.utils.c.e();
        goto L_0x002e;
    L_0x00ed:
        r0 = "com.taobao.taobao:id/auction";
        r0 = r10.findByResId(r0, r7);
        r0 = r0.exists();
        r3 = new java.lang.StringBuilder;
        r3.<init>();
        r4 = " list view exists:";
        r3 = r3.append(r4);
        r3 = r3.append(r0);
        r4 = " at round :";
        r3 = r3.append(r4);
        r3 = r3.append(r1);
        r3 = r3.toString();
        r4 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r3, r4);
        if (r0 != 0) goto L_0x003f;
    L_0x011b:
        com.sutuijingling.utils.c.e();
        r0 = r1;
        goto L_0x002f;
    L_0x0121:
        r3 = new com.android.uiautomator.core.UiScrollable;
        r6 = new com.android.uiautomator.core.UiSelector;
        r6.<init>();
        r6 = r6.scrollable(r7);
        r3.<init>(r6);
        r3 = r3.exists();
        if (r3 != 0) goto L_0x0138;
    L_0x0135:
        r0 = r1;
        goto L_0x0078;
    L_0x0138:
        r3 = "没有更多宝贝啦";
        r3 = r10.findText(r3, r7);
        if (r3 == 0) goto L_0x014d;
    L_0x0140:
        r3 = r3.exists();
        if (r3 == 0) goto L_0x014d;
    L_0x0146:
        if (r0 <= r9) goto L_0x014b;
    L_0x0148:
        r0 = r1;
        goto L_0x0078;
    L_0x014b:
        r0 = r0 + 1;
    L_0x014d:
        r3 = "没有找到相关的宝贝";
        r3 = r10.findTextContain(r3, r7);
        if (r3 == 0) goto L_0x015e;
    L_0x0155:
        r3 = r3.exists();
        if (r3 == 0) goto L_0x015e;
    L_0x015b:
        r0 = r1;
        goto L_0x0078;
    L_0x015e:
        r3 = "您是不是想找";
        r3 = r10.findTextContain(r3, r7);
        if (r3 == 0) goto L_0x016f;
    L_0x0166:
        r3 = r3.exists();
        if (r3 == 0) goto L_0x016f;
    L_0x016c:
        r0 = r1;
        goto L_0x0078;
    L_0x016f:
        r10.simpleDragScroll(r7, r8);
        r3 = r4;
        goto L_0x0049;
    L_0x0175:
        r0 = r10.searchParams;
        r0 = r0.isZxClickOther();
        if (r0 != r7) goto L_0x0180;
    L_0x017d:
        r10.f(r5);
    L_0x0180:
        com.sutuijingling.utils.c.c();
        r10.simpleDragScroll(r7, r8);
        return;
    L_0x0187:
        r0 = r1;
        goto L_0x0078;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sutuijingling.a.i.v():void");
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void w() throws com.android.uiautomator.core.UiObjectNotFoundException, com.sutuijingling.result.c {
        /*
        r14 = this;
        r12 = 3000; // 0xbb8 float:4.204E-42 double:1.482E-320;
        r11 = 4;
        r10 = -1;
        r2 = 0;
        r9 = 1;
        r0 = r14.missionId;
        r3 = 8000; // 0x1f40 float:1.121E-41 double:3.9525E-320;
        com.sutuijingling.result.w.a(r0, r3);
        r14.checkAppIsCode();
        r0 = r14.searchParams;
        r5 = r0.getTitle();
        r0 = java.lang.System.out;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r3 = " try match title:";
        r1 = r1.append(r3);
        r1 = r1.append(r5);
        r1 = r1.toString();
        r0.println(r1);
        r0 = r14.hasSearchResultGidMid();
        if (r0 == 0) goto L_0x00b8;
    L_0x0034:
        r14.I();
        com.sutuijingling.utils.c.e();
    L_0x003a:
        r0 = r2;
    L_0x003b:
        r1 = r0 + 1;
        if (r0 >= r11) goto L_0x004b;
    L_0x003f:
        r0 = "com.taobao.taobao:layout/tbsearch_item_list_improve";
        r0 = r14.findByResId(r0, r9);
        r0 = r0.exists();
        if (r0 == 0) goto L_0x0115;
    L_0x004b:
        com.sutuijingling.utils.c.c();
        r1 = 0;
        r0 = r14.searchParams;
        r0 = r0.isZhiTongChe();
        if (r0 == 0) goto L_0x0157;
    L_0x0057:
        r0 = r14.ac();
    L_0x005b:
        r3 = r2;
    L_0x005c:
        r4 = k;
        r6 = r4 + 1;
        k = r6;
        if (r4 >= r0) goto L_0x0297;
    L_0x0064:
        com.sutuijingling.utils.c.b();
        r1 = r14.device;
        r6 = r1.getDisplayHeight();
        r1 = r14.searchParams;
        r1 = r1.isZhiTongChe();
        if (r1 != r9) goto L_0x015d;
    L_0x0075:
        r4 = r14.u();
    L_0x0079:
        if (r4 == 0) goto L_0x0199;
    L_0x007b:
        r1 = r4.exists();
        if (r1 == 0) goto L_0x0199;
    L_0x0081:
        r1 = "com.taobao.taobao:id/search_header_container";
        r1 = r14.findByResId(r1, r9);
        if (r1 == 0) goto L_0x008f;
    L_0x0089:
        r7 = r1.exists();
        if (r7 != 0) goto L_0x0095;
    L_0x008f:
        r1 = "com.taobao.taobao:id/float_header";
        r1 = r14.findByResId(r1, r9);
    L_0x0095:
        if (r1 == 0) goto L_0x029a;
    L_0x0097:
        r7 = r1.exists();
        if (r7 == 0) goto L_0x029a;
    L_0x009d:
        r1 = r1.getBounds();
        r1 = r1.bottom;
    L_0x00a3:
        r7 = r4.getBounds();
        r7 = r7.top;
        r8 = r4.getBounds();
        r8 = r8.bottom;
        if (r8 <= r6) goto L_0x0163;
    L_0x00b1:
        r14.a(r1, r6, r9);
        h = r10;
        r1 = r4;
        goto L_0x005c;
    L_0x00b8:
        r0 = "com.taobao.taobao:id/auction";
        r0 = r14.findByResId(r0, r9);
        if (r0 == 0) goto L_0x00c6;
    L_0x00c0:
        r1 = r0.exists();
        if (r1 != 0) goto L_0x00cc;
    L_0x00c6:
        r0 = "com.taobao.taobao:id/auction_layout";
        r0 = r14.findByResId(r0, r9);
    L_0x00cc:
        r1 = r0.exists();
        if (r1 == 0) goto L_0x003a;
    L_0x00d2:
        r0 = r0.getBounds();
        r1 = r0.right;
        r3 = r0.left;
        r1 = r1 - r3;
        r1 = java.lang.Math.abs(r1);
        r3 = r0.bottom;
        r0 = r0.top;
        r0 = r3 - r0;
        r0 = java.lang.Math.abs(r0);
        r3 = java.lang.System.out;
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r6 = "item layout width:";
        r4 = r4.append(r6);
        r4 = r4.append(r1);
        r6 = ", height:";
        r4 = r4.append(r6);
        r4 = r4.append(r0);
        r4 = r4.toString();
        r3.println(r4);
        if (r1 >= r0) goto L_0x003a;
    L_0x010d:
        r14.I();
        com.sutuijingling.utils.c.e();
        goto L_0x003a;
    L_0x0115:
        r0 = "com.taobao.taobao:id/auction";
        r0 = r14.findByResId(r0, r9);
        if (r0 == 0) goto L_0x0123;
    L_0x011d:
        r3 = r0.exists();
        if (r3 != 0) goto L_0x0129;
    L_0x0123:
        r0 = "com.taobao.taobao:id/auction_layout";
        r0 = r14.findByResId(r0, r9);
    L_0x0129:
        r0 = r0.exists();
        r3 = new java.lang.StringBuilder;
        r3.<init>();
        r4 = " list view exists:";
        r3 = r3.append(r4);
        r3 = r3.append(r0);
        r4 = " at round :";
        r3 = r3.append(r4);
        r3 = r3.append(r1);
        r3 = r3.toString();
        r4 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r3, r4);
        if (r0 != 0) goto L_0x004b;
    L_0x0151:
        com.sutuijingling.utils.c.e();
        r0 = r1;
        goto L_0x003b;
    L_0x0157:
        r0 = r14.ae();
        goto L_0x005b;
    L_0x015d:
        r4 = r14.s();
        goto L_0x0079;
    L_0x0163:
        if (r7 > r1) goto L_0x016d;
    L_0x0165:
        r14.a(r1, r6, r2);
        h = r10;
        r1 = r4;
        goto L_0x005c;
    L_0x016d:
        r0 = r4.getText();
        g = r0;
    L_0x0173:
        r14.debugUiObject(r4);
        if (r4 == 0) goto L_0x017e;
    L_0x0178:
        r0 = r4.exists();
        if (r0 != 0) goto L_0x0208;
    L_0x017e:
        r0 = new com.sutuijingling.result.c;
        r1 = NOT_EXIST;
        r2 = new java.lang.StringBuilder;
        r2.<init>();
        r3 = "title 找不到宝贝id....";
        r2 = r2.append(r3);
        r2 = r2.append(r5);
        r2 = r2.toString();
        r0.<init>(r1, r2);
        throw r0;
    L_0x0199:
        r1 = r14.searchParams;
        r1 = r1.isHuobi();
        if (r1 != r9) goto L_0x01a4;
    L_0x01a1:
        r14.a(r6);
    L_0x01a4:
        r1 = new com.android.uiautomator.core.UiScrollable;
        r6 = new com.android.uiautomator.core.UiSelector;
        r6.<init>();
        r6 = r6.scrollable(r9);
        r1.<init>(r6);
        r1 = r1.exists();
        if (r1 == 0) goto L_0x0173;
    L_0x01b8:
        r1 = "没有更多宝贝";
        r1 = r14.findTextContain(r1, r9);
        if (r1 == 0) goto L_0x0294;
    L_0x01c0:
        r1 = r1.exists();
        if (r1 == 0) goto L_0x0294;
    L_0x01c6:
        r1 = 2;
        if (r3 > r1) goto L_0x0173;
    L_0x01c9:
        r3 = r3 + 1;
        r1 = r3;
    L_0x01cc:
        r3 = "没有搜索结果";
        r3 = r14.findTextContain(r3, r9);
        if (r3 == 0) goto L_0x01da;
    L_0x01d4:
        r3 = r3.exists();
        if (r3 != 0) goto L_0x0173;
    L_0x01da:
        r3 = "没有找到相关的宝贝";
        r3 = r14.findTextContain(r3, r9);
        if (r3 == 0) goto L_0x01e8;
    L_0x01e2:
        r3 = r3.exists();
        if (r3 != 0) goto L_0x0173;
    L_0x01e8:
        r3 = "是不是想找";
        r3 = r14.findTextContain(r3, r9);
        if (r3 == 0) goto L_0x01f6;
    L_0x01f0:
        r3 = r3.exists();
        if (r3 != 0) goto L_0x0173;
    L_0x01f6:
        r3 = k;
        r6 = 2;
        if (r3 != r6) goto L_0x0204;
    L_0x01fb:
        r14.simpleDragScroll(r9, r11);
    L_0x01fe:
        h = r10;
        r3 = r1;
        r1 = r4;
        goto L_0x005c;
    L_0x0204:
        r14.simpleDragScroll(r9, r11);
        goto L_0x01fe;
    L_0x0208:
        r0 = java.lang.System.out;
        r1 = " do click  title";
        r0.println(r1);
        com.sutuijingling.utils.c.a(r4, r12);
        com.sutuijingling.utils.c.d();
        r0 = " press device round 1";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = u;
        if (r0 != 0) goto L_0x0228;
    L_0x0220:
        r0 = " no need to exsit...";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
    L_0x0227:
        return;
    L_0x0228:
        r0 = r14.isItemDetail();
        if (r0 == 0) goto L_0x024b;
    L_0x022e:
        r0 = r14.device;
        r0.pressBack();
        com.sutuijingling.utils.c.e();
        r0 = r14.isSearchResultPage();
        if (r0 != 0) goto L_0x0248;
    L_0x023c:
        r0 = " press device round 2";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = r14.device;
        r0.pressBack();
    L_0x0248:
        com.sutuijingling.utils.c.e();
    L_0x024b:
        com.sutuijingling.utils.c.d();
        r0 = r14.s();
        r1 = r0.exists();
        if (r1 == 0) goto L_0x025f;
    L_0x0258:
        com.sutuijingling.utils.c.a(r0, r12);
        com.sutuijingling.utils.c.e();
        goto L_0x0227;
    L_0x025f:
        r0 = " press device round 3";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = r14.isItemDetail();
        if (r0 == 0) goto L_0x0289;
    L_0x026c:
        r0 = r14.device;
        r0.pressBack();
        com.sutuijingling.utils.c.e();
        r0 = r14.isSearchResultPage();
        if (r0 != 0) goto L_0x0286;
    L_0x027a:
        r0 = " press device round 4";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = r14.device;
        r0.pressBack();
    L_0x0286:
        com.sutuijingling.utils.c.e();
    L_0x0289:
        r0 = r14.s();
        com.sutuijingling.utils.c.a(r0, r12);
        com.sutuijingling.utils.c.c();
        goto L_0x0227;
    L_0x0294:
        r1 = r3;
        goto L_0x01cc;
    L_0x0297:
        r4 = r1;
        goto L_0x0173;
    L_0x029a:
        r1 = r2;
        goto L_0x00a3;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sutuijingling.a.i.w():void");
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void x() throws com.android.uiautomator.core.UiObjectNotFoundException, com.sutuijingling.result.c {
        /*
        r13 = this;
        r12 = 4;
        r10 = 3000; // 0xbb8 float:4.204E-42 double:1.482E-320;
        r9 = -1;
        r2 = 0;
        r8 = 1;
        r13.checkAppIsCode();
        r0 = r13.hasSearchResultGidMid();
        if (r0 == 0) goto L_0x0085;
    L_0x000f:
        r13.I();
        com.sutuijingling.utils.c.e();
    L_0x0015:
        r0 = r2;
    L_0x0016:
        r1 = r0 + 1;
        if (r0 >= r12) goto L_0x0026;
    L_0x001a:
        r0 = "com.taobao.taobao:layout/tbsearch_item_list_improve";
        r0 = r13.findByResId(r0, r8);
        r0 = r0.exists();
        if (r0 == 0) goto L_0x00e2;
    L_0x0026:
        r1 = 0;
        r0 = r13.searchParams;
        r0 = r0.isZhiTongChe();
        if (r0 == 0) goto L_0x0116;
    L_0x002f:
        r0 = r13.ac();
    L_0x0033:
        r3 = r2;
    L_0x0034:
        r4 = k;
        r5 = r4 + 1;
        k = r5;
        if (r4 >= r0) goto L_0x022b;
    L_0x003c:
        r1 = r13.device;
        r5 = r1.getDisplayHeight();
        r4 = r13.t();
        if (r4 == 0) goto L_0x0141;
    L_0x0048:
        r1 = r4.exists();
        if (r1 == 0) goto L_0x0141;
    L_0x004e:
        r1 = "com.taobao.taobao:id/search_header_container";
        r1 = r13.findByResId(r1, r8);
        if (r1 == 0) goto L_0x005c;
    L_0x0056:
        r6 = r1.exists();
        if (r6 != 0) goto L_0x0062;
    L_0x005c:
        r1 = "com.taobao.taobao:id/float_header";
        r1 = r13.findByResId(r1, r8);
    L_0x0062:
        if (r1 == 0) goto L_0x022e;
    L_0x0064:
        r6 = r1.exists();
        if (r6 == 0) goto L_0x022e;
    L_0x006a:
        r1 = r1.getBounds();
        r1 = r1.bottom;
    L_0x0070:
        r6 = r4.getBounds();
        r6 = r6.top;
        r7 = r4.getBounds();
        r7 = r7.bottom;
        if (r7 <= r5) goto L_0x011c;
    L_0x007e:
        r13.a(r1, r5, r8);
        h = r9;
        r1 = r4;
        goto L_0x0034;
    L_0x0085:
        r0 = "com.taobao.taobao:id/auction";
        r0 = r13.findByResId(r0, r8);
        if (r0 == 0) goto L_0x0093;
    L_0x008d:
        r1 = r0.exists();
        if (r1 != 0) goto L_0x0099;
    L_0x0093:
        r0 = "com.taobao.taobao:id/auction_layout";
        r0 = r13.findByResId(r0, r8);
    L_0x0099:
        r1 = r0.exists();
        if (r1 == 0) goto L_0x0015;
    L_0x009f:
        r0 = r0.getBounds();
        r1 = r0.right;
        r3 = r0.left;
        r1 = r1 - r3;
        r1 = java.lang.Math.abs(r1);
        r3 = r0.bottom;
        r0 = r0.top;
        r0 = r3 - r0;
        r0 = java.lang.Math.abs(r0);
        r3 = java.lang.System.out;
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r5 = "item layout width:";
        r4 = r4.append(r5);
        r4 = r4.append(r1);
        r5 = ", height:";
        r4 = r4.append(r5);
        r4 = r4.append(r0);
        r4 = r4.toString();
        r3.println(r4);
        if (r1 >= r0) goto L_0x0015;
    L_0x00da:
        r13.I();
        com.sutuijingling.utils.c.e();
        goto L_0x0015;
    L_0x00e2:
        r0 = "com.taobao.taobao:id/auction";
        r0 = r13.findByResId(r0, r8);
        r0 = r0.exists();
        r3 = new java.lang.StringBuilder;
        r3.<init>();
        r4 = " list view exists:";
        r3 = r3.append(r4);
        r3 = r3.append(r0);
        r4 = " at round :";
        r3 = r3.append(r4);
        r3 = r3.append(r1);
        r3 = r3.toString();
        r4 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r3, r4);
        if (r0 != 0) goto L_0x0026;
    L_0x0110:
        com.sutuijingling.utils.c.e();
        r0 = r1;
        goto L_0x0016;
    L_0x0116:
        r0 = r13.ae();
        goto L_0x0033;
    L_0x011c:
        if (r6 > r1) goto L_0x0126;
    L_0x011e:
        r13.a(r1, r5, r2);
        h = r9;
        r1 = r4;
        goto L_0x0034;
    L_0x0126:
        r0 = r4.getText();
        g = r0;
    L_0x012c:
        r13.debugUiObject(r4);
        if (r4 == 0) goto L_0x0137;
    L_0x0131:
        r0 = r4.exists();
        if (r0 != 0) goto L_0x019c;
    L_0x0137:
        r0 = new com.sutuijingling.result.c;
        r1 = NOT_EXIST;
        r2 = "title 找不到宝贝id....";
        r0.<init>(r1, r2);
        throw r0;
    L_0x0141:
        r1 = new com.android.uiautomator.core.UiScrollable;
        r5 = new com.android.uiautomator.core.UiSelector;
        r5.<init>();
        r5 = r5.scrollable(r8);
        r1.<init>(r5);
        r1 = r1.exists();
        if (r1 == 0) goto L_0x012c;
    L_0x0155:
        r1 = "没有更多宝贝";
        r1 = r13.findTextContain(r1, r8);
        if (r1 == 0) goto L_0x0228;
    L_0x015d:
        r1 = r1.exists();
        if (r1 == 0) goto L_0x0228;
    L_0x0163:
        r1 = 2;
        if (r3 > r1) goto L_0x012c;
    L_0x0166:
        r3 = r3 + 1;
        r1 = r3;
    L_0x0169:
        r3 = "没有搜索结果";
        r3 = r13.findTextContain(r3, r8);
        if (r3 == 0) goto L_0x0177;
    L_0x0171:
        r3 = r3.exists();
        if (r3 != 0) goto L_0x012c;
    L_0x0177:
        r3 = "没有找到相关的宝贝";
        r3 = r13.findTextContain(r3, r8);
        if (r3 == 0) goto L_0x0185;
    L_0x017f:
        r3 = r3.exists();
        if (r3 != 0) goto L_0x012c;
    L_0x0185:
        r3 = "是不是想找";
        r3 = r13.findTextContain(r3, r8);
        if (r3 == 0) goto L_0x0193;
    L_0x018d:
        r3 = r3.exists();
        if (r3 != 0) goto L_0x012c;
    L_0x0193:
        r13.simpleDragScroll(r8, r12);
        h = r9;
        r3 = r1;
        r1 = r4;
        goto L_0x0034;
    L_0x019c:
        r0 = java.lang.System.out;
        r1 = " do click  title";
        r0.println(r1);
        com.sutuijingling.utils.c.a(r4, r10);
        com.sutuijingling.utils.c.d();
        r0 = " press device round 1";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = u;
        if (r0 != 0) goto L_0x01bc;
    L_0x01b4:
        r0 = " no need to exsit...";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
    L_0x01bb:
        return;
    L_0x01bc:
        r0 = r13.isItemDetail();
        if (r0 == 0) goto L_0x01df;
    L_0x01c2:
        r0 = r13.device;
        r0.pressBack();
        com.sutuijingling.utils.c.e();
        r0 = r13.isSearchResultPage();
        if (r0 != 0) goto L_0x01dc;
    L_0x01d0:
        r0 = " press device round 2";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = r13.device;
        r0.pressBack();
    L_0x01dc:
        com.sutuijingling.utils.c.e();
    L_0x01df:
        com.sutuijingling.utils.c.d();
        r0 = r13.s();
        r1 = r0.exists();
        if (r1 == 0) goto L_0x01f3;
    L_0x01ec:
        com.sutuijingling.utils.c.a(r0, r10);
        com.sutuijingling.utils.c.e();
        goto L_0x01bb;
    L_0x01f3:
        r0 = " press device round 3";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = r13.isItemDetail();
        if (r0 == 0) goto L_0x021d;
    L_0x0200:
        r0 = r13.device;
        r0.pressBack();
        com.sutuijingling.utils.c.e();
        r0 = r13.isSearchResultPage();
        if (r0 != 0) goto L_0x021a;
    L_0x020e:
        r0 = " press device round 4";
        r1 = new java.lang.Object[r2];
        com.sutuijingling.utils.b.b(r0, r1);
        r0 = r13.device;
        r0.pressBack();
    L_0x021a:
        com.sutuijingling.utils.c.e();
    L_0x021d:
        r0 = r13.s();
        com.sutuijingling.utils.c.a(r0, r10);
        com.sutuijingling.utils.c.c();
        goto L_0x01bb;
    L_0x0228:
        r1 = r3;
        goto L_0x0169;
    L_0x022b:
        r4 = r1;
        goto L_0x012c;
    L_0x022e:
        r1 = r2;
        goto L_0x0070;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.sutuijingling.a.i.x():void");
    }

    public boolean y() {
        if (this.searchParams.isHuobi()) {
            int huobiNum = this.searchParams.getHuobiNum();
            return huobiNum > 0 && p < huobiNum;
        } else {
            System.out.println("not need huobi!");
            return false;
        }
    }

    public boolean z() {
        UiObject findByResId = findByResId("com.taobao.taobao:id/auction", 1);
        if (findByResId != null && findByResId.exists()) {
            return true;
        }
        findByResId = findByResId("com.taobao.taobao:id/searchEdit", 1);
        return findByResId != null && findByResId.exists();
    }
}
